debug: Log auto accepting event.

2024-05-20_merge
tecnovert 3 years ago
parent d2324ad097
commit e7a62a6a82
No known key found for this signature in database
GPG Key ID: 8ED6D8750C4E3F93
  1. 7
      basicswap/basicswap.py
  2. 5
      basicswap/basicswap_util.py
  3. 10
      basicswap/protocols/xmr_swap_1.py

@ -3874,6 +3874,12 @@ class BasicSwap(BaseApp):
if identity_stats.num_recv_bids_successful <= identity_stats.num_recv_bids_failed:
raise AutomationConstraint('Bidder has too many failed swaps')
self.logEvent(Concepts.BID,
bid.bid_id,
EventLogTypes.AUTOMATION_ACCEPTING_BID,
'',
use_session)
return True
except AutomationConstraint as e:
self.log.info('Not auto accepting bid {}, {}'.format(bid.bid_id.hex(), str(e)))
@ -3889,6 +3895,7 @@ class BasicSwap(BaseApp):
return False
finally:
if session is None:
use_session.commit()
use_session.close()
use_session.remove()
self.mxDB.release()

@ -157,6 +157,7 @@ class EventLogTypes(IntEnum):
LOCK_TX_A_REFUND_SPEND_TX_SEEN = auto()
ERROR = auto()
AUTOMATION_CONSTRAINT = auto()
AUTOMATION_ACCEPTING_BID = auto()
class XmrSplitMsgTypes(IntEnum):
@ -335,6 +336,10 @@ def describeEventEntry(event_type, event_msg):
return 'Warning: ' + event_msg
if event_type == EventLogTypes.ERROR:
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):

@ -46,12 +46,18 @@ def recoverNoScriptTxnWithKey(self, bid_id, encoded_key):
ci_to = self.ci(offer.coin_to)
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:
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)
else:
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(kbsf), 'Invalid kbsf')
vkbs = ci_to.sumKeys(kbsl, kbsf)

Loading…
Cancel
Save