mirror of
https://github.com/basicswap/basicswap.git
synced 2024-12-23 11:59:36 +00:00
debug: Log auto accepting event.
This commit is contained in:
parent
d2324ad097
commit
e7a62a6a82
3 changed files with 20 additions and 2 deletions
|
@ -3874,6 +3874,12 @@ class BasicSwap(BaseApp):
|
||||||
if identity_stats.num_recv_bids_successful <= identity_stats.num_recv_bids_failed:
|
if identity_stats.num_recv_bids_successful <= identity_stats.num_recv_bids_failed:
|
||||||
raise AutomationConstraint('Bidder has too many failed swaps')
|
raise AutomationConstraint('Bidder has too many failed swaps')
|
||||||
|
|
||||||
|
self.logEvent(Concepts.BID,
|
||||||
|
bid.bid_id,
|
||||||
|
EventLogTypes.AUTOMATION_ACCEPTING_BID,
|
||||||
|
'',
|
||||||
|
use_session)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
except AutomationConstraint as e:
|
except AutomationConstraint as e:
|
||||||
self.log.info('Not auto accepting bid {}, {}'.format(bid.bid_id.hex(), str(e)))
|
self.log.info('Not auto accepting bid {}, {}'.format(bid.bid_id.hex(), str(e)))
|
||||||
|
@ -3889,6 +3895,7 @@ class BasicSwap(BaseApp):
|
||||||
return False
|
return False
|
||||||
finally:
|
finally:
|
||||||
if session is None:
|
if session is None:
|
||||||
|
use_session.commit()
|
||||||
use_session.close()
|
use_session.close()
|
||||||
use_session.remove()
|
use_session.remove()
|
||||||
self.mxDB.release()
|
self.mxDB.release()
|
||||||
|
|
|
@ -157,6 +157,7 @@ class EventLogTypes(IntEnum):
|
||||||
LOCK_TX_A_REFUND_SPEND_TX_SEEN = auto()
|
LOCK_TX_A_REFUND_SPEND_TX_SEEN = auto()
|
||||||
ERROR = auto()
|
ERROR = auto()
|
||||||
AUTOMATION_CONSTRAINT = auto()
|
AUTOMATION_CONSTRAINT = auto()
|
||||||
|
AUTOMATION_ACCEPTING_BID = auto()
|
||||||
|
|
||||||
|
|
||||||
class XmrSplitMsgTypes(IntEnum):
|
class XmrSplitMsgTypes(IntEnum):
|
||||||
|
@ -335,6 +336,10 @@ def describeEventEntry(event_type, event_msg):
|
||||||
return 'Warning: ' + event_msg
|
return 'Warning: ' + event_msg
|
||||||
if event_type == EventLogTypes.ERROR:
|
if event_type == EventLogTypes.ERROR:
|
||||||
return 'Error: ' + event_msg
|
return 'Error: ' + event_msg
|
||||||
|
if event_type == EventLogTypes.AUTOMATION_CONSTRAINT:
|
||||||
|
return 'Failed auto accepting'
|
||||||
|
if event_type == EventLogTypes.AUTOMATION_ACCEPTING_BID:
|
||||||
|
return 'Auto accepting'
|
||||||
|
|
||||||
|
|
||||||
def getVoutByAddress(txjs, p2sh):
|
def getVoutByAddress(txjs, p2sh):
|
||||||
|
|
|
@ -46,12 +46,18 @@ def recoverNoScriptTxnWithKey(self, bid_id, encoded_key):
|
||||||
ci_to = self.ci(offer.coin_to)
|
ci_to = self.ci(offer.coin_to)
|
||||||
|
|
||||||
for_ed25519 = True if Coins(offer.coin_to) == Coins.XMR else False
|
for_ed25519 = True if Coins(offer.coin_to) == Coins.XMR else False
|
||||||
|
|
||||||
|
try:
|
||||||
|
decoded_key_half = ci_to.decodeKey(encoded_key)
|
||||||
|
except Exception as e:
|
||||||
|
raise ValueError('Failed to decode provided key-half: ', str(e))
|
||||||
|
|
||||||
if bid.was_sent:
|
if bid.was_sent:
|
||||||
kbsl = ci_to.decodeKey(encoded_key)
|
kbsl = decoded_key_half
|
||||||
kbsf = self.getPathKey(offer.coin_from, offer.coin_to, bid.created_at, xmr_swap.contract_count, KeyTypes.KBSF, for_ed25519)
|
kbsf = self.getPathKey(offer.coin_from, offer.coin_to, bid.created_at, xmr_swap.contract_count, KeyTypes.KBSF, for_ed25519)
|
||||||
else:
|
else:
|
||||||
kbsl = self.getPathKey(offer.coin_from, offer.coin_to, bid.created_at, xmr_swap.contract_count, KeyTypes.KBSL, for_ed25519)
|
kbsl = self.getPathKey(offer.coin_from, offer.coin_to, bid.created_at, xmr_swap.contract_count, KeyTypes.KBSL, for_ed25519)
|
||||||
kbsf = ci_to.decodeKey(encoded_key)
|
kbsf = decoded_key_half
|
||||||
ensure(ci_to.verifyKey(kbsl), 'Invalid kbsl')
|
ensure(ci_to.verifyKey(kbsl), 'Invalid kbsl')
|
||||||
ensure(ci_to.verifyKey(kbsf), 'Invalid kbsf')
|
ensure(ci_to.verifyKey(kbsf), 'Invalid kbsf')
|
||||||
vkbs = ci_to.sumKeys(kbsl, kbsf)
|
vkbs = ci_to.sumKeys(kbsl, kbsf)
|
||||||
|
|
Loading…
Reference in a new issue