Log events when xmr refund and refund spend txns are seen.
This commit is contained in:
parent
4a7eff0118
commit
82e2b128c9
@ -3375,6 +3375,7 @@ class BasicSwap(BaseApp):
|
||||
elif spending_txid == xmr_swap.a_lock_refund_tx_id:
|
||||
self.log.debug('Coin a lock tx spent by lock refund tx.')
|
||||
bid.setState(BidStates.XMR_SWAP_SCRIPT_TX_PREREFUND)
|
||||
self.logBidEvent(bid.bid_id, EventLogTypes.LOCK_TX_A_REFUND_TX_SEEN, '', session)
|
||||
else:
|
||||
self.setBidError(bid.bid_id, bid, 'Unexpected txn spent coin a lock tx: {}'.format(spend_txid_hex), save_bid=False)
|
||||
|
||||
@ -3409,6 +3410,7 @@ class BasicSwap(BaseApp):
|
||||
|
||||
if spending_txid == xmr_swap.a_lock_refund_spend_tx_id:
|
||||
self.log.info('Found coin a lock refund spend tx, bid {}'.format(bid_id.hex()))
|
||||
self.logBidEvent(bid.bid_id, EventLogTypes.LOCK_TX_A_REFUND_SPEND_TX_SEEN, '', session)
|
||||
|
||||
if bid.was_sent:
|
||||
xmr_swap.a_lock_refund_spend_tx = bytes.fromhex(spend_txn['hex']) # Replace with fully signed tx
|
||||
|
@ -144,6 +144,8 @@ class EventLogTypes(IntEnum):
|
||||
SYSTEM_WARNING = auto()
|
||||
LOCK_TX_A_SPEND_TX_PUBLISHED = auto()
|
||||
LOCK_TX_B_SPEND_TX_PUBLISHED = auto()
|
||||
LOCK_TX_A_REFUND_TX_SEEN = auto()
|
||||
LOCK_TX_A_REFUND_SPEND_TX_SEEN = auto()
|
||||
|
||||
|
||||
class XmrSplitMsgTypes(IntEnum):
|
||||
@ -207,6 +209,8 @@ def strBidState(state):
|
||||
return 'Script coin lock released'
|
||||
if state == BidStates.XMR_SWAP_SCRIPT_TX_REDEEMED:
|
||||
return 'Script tx redeemed'
|
||||
if state == BidStates.XMR_SWAP_SCRIPT_TX_PREREFUND:
|
||||
return 'Script pre-refund tx in chain'
|
||||
if state == BidStates.XMR_SWAP_NOSCRIPT_TX_REDEEMED:
|
||||
return 'Scriptless tx redeemed'
|
||||
if state == BidStates.XMR_SWAP_NOSCRIPT_TX_RECOVERED:
|
||||
@ -219,7 +223,7 @@ def strBidState(state):
|
||||
return 'Failed'
|
||||
if state == BidStates.SWAP_DELAYING:
|
||||
return 'Delaying'
|
||||
return 'Unknown'
|
||||
return 'Unknown' + ' ' + str(state)
|
||||
|
||||
|
||||
def strTxState(state):
|
||||
@ -312,6 +316,10 @@ def describeEventEntry(event_type, event_msg):
|
||||
return 'Lock tx A spend tx published'
|
||||
if event_type == EventLogTypes.LOCK_TX_B_SPEND_TX_PUBLISHED:
|
||||
return 'Lock tx B spend tx published'
|
||||
if event_type == EventLogTypes.LOCK_TX_A_REFUND_TX_SEEN:
|
||||
return 'Lock tx A refund tx seen in chain'
|
||||
if event_type == EventLogTypes.LOCK_TX_A_REFUND_SPEND_TX_SEEN:
|
||||
return 'Lock tx A refund spend tx seen in chain'
|
||||
if event_type == EventLogTypes.SYSTEM_WARNING:
|
||||
return 'Warning: ' + event_msg
|
||||
|
||||
|
@ -567,8 +567,8 @@ class HttpHandler(BaseHTTPRequestHandler):
|
||||
if page_data['amt_var'] or page_data['rate_var']:
|
||||
page_data['autoaccept'] = False
|
||||
|
||||
if b'step1' in form_data:
|
||||
if len(errors) == 0 and b'continue' in form_data:
|
||||
if have_data_entry(form_data, 'step1'):
|
||||
if len(errors) == 0 and have_data_entry(form_data, 'continue'):
|
||||
page_data['step2'] = True
|
||||
return parsed_data, errors
|
||||
|
||||
@ -727,6 +727,8 @@ class HttpHandler(BaseHTTPRequestHandler):
|
||||
for e in errors:
|
||||
messages.append('Error: {}'.format(str(e)))
|
||||
except Exception as e:
|
||||
if swap_client.debug is True:
|
||||
swap_client.log.error(traceback.format_exc())
|
||||
messages.append('Error: {}'.format(str(e)))
|
||||
|
||||
if len(messages) == 0 and 'submit_offer' in page_data:
|
||||
@ -735,6 +737,8 @@ class HttpHandler(BaseHTTPRequestHandler):
|
||||
messages.append('<a href="/offer/' + offer_id.hex() + '">Sent Offer {}</a>'.format(offer_id.hex()))
|
||||
page_data = {}
|
||||
except Exception as e:
|
||||
if swap_client.debug is True:
|
||||
swap_client.log.error(traceback.format_exc())
|
||||
messages.append('Error: {}'.format(str(e)))
|
||||
|
||||
if len(messages) == 0 and 'check_offer' in page_data:
|
||||
|
Loading…
Reference in New Issue
Block a user