mirror of
https://github.com/basicswap/basicswap.git
synced 2024-12-22 19:49:20 +00:00
Add event when BCH mercy tx published.
Some checks failed
lint / build (3.12) (push) Has been cancelled
Some checks failed
lint / build (3.12) (push) Has been cancelled
This commit is contained in:
parent
bae735c144
commit
bd4291ab45
2 changed files with 14 additions and 5 deletions
|
@ -3879,19 +3879,25 @@ class BasicSwap(BaseApp):
|
||||||
tx_type=TxTypes.XMR_SWAP_A_LOCK_REFUND_SWIPE,
|
tx_type=TxTypes.XMR_SWAP_A_LOCK_REFUND_SWIPE,
|
||||||
txid=bytes.fromhex(txid),
|
txid=bytes.fromhex(txid),
|
||||||
)
|
)
|
||||||
self.saveBidInSession(bid_id, bid, session, xmr_swap)
|
|
||||||
session.commit()
|
|
||||||
|
|
||||||
if self.isBchXmrSwap(offer):
|
if self.isBchXmrSwap(offer):
|
||||||
if ci_from.altruistic():
|
if ci_from.altruistic():
|
||||||
for_ed25519: bool = True if ci_to.curve_type() == Curves.ed25519 else False
|
for_ed25519: bool = True if ci_to.curve_type() == Curves.ed25519 else False
|
||||||
kbsf = self.getPathKey(ci_from.coin_type(), ci_to.coin_type(), bid.created_at, xmr_swap.contract_count, KeyTypes.KBSF, for_ed25519)
|
kbsf = self.getPathKey(ci_from.coin_type(), ci_to.coin_type(), bid.created_at, xmr_swap.contract_count, KeyTypes.KBSF, for_ed25519)
|
||||||
|
|
||||||
mercy_tx = ci_from.createMercyTx(xmr_swap.a_lock_refund_swipe_tx, h2b(txid), xmr_swap.a_lock_refund_tx_script, kbsf)
|
mercy_tx = ci_from.createMercyTx(xmr_swap.a_lock_refund_swipe_tx, h2b(txid), xmr_swap.a_lock_refund_tx_script, kbsf)
|
||||||
txid = ci_from.publishTx(mercy_tx)
|
txid_hex: str = ci_from.publishTx(mercy_tx)
|
||||||
self.log.info('Submitted mercy tx for bid {}, txid {}'.format(bid_id.hex(), txid))
|
bid.txns[TxTypes.BCH_MERCY] = SwapTx(
|
||||||
|
bid_id=bid_id,
|
||||||
|
tx_type=TxTypes.BCH_MERCY,
|
||||||
|
txid=bytes.fromhex(txid_hex),
|
||||||
|
)
|
||||||
|
self.log.info('Submitted mercy tx for bid {}, txid {}'.format(bid_id.hex(), txid_hex))
|
||||||
|
self.logBidEvent(bid_id, EventLogTypes.BCH_MERCY_TX_PUBLISHED, '', session)
|
||||||
else:
|
else:
|
||||||
self.log.info('Not sending mercy tx for bid {}'.format(bid_id.hex()))
|
self.log.info('Not sending mercy tx for bid {}'.format(bid_id.hex()))
|
||||||
|
|
||||||
|
self.saveBidInSession(bid_id, bid, session, xmr_swap)
|
||||||
|
session.commit()
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.log.debug('Trying to publish coin a lock refund swipe tx: %s', str(ex))
|
self.log.debug('Trying to publish coin a lock refund swipe tx: %s', str(ex))
|
||||||
|
|
||||||
|
|
|
@ -186,6 +186,7 @@ class EventLogTypes(IntEnum):
|
||||||
PTX_REDEEM_PUBLISHED = auto()
|
PTX_REDEEM_PUBLISHED = auto()
|
||||||
PTX_REFUND_PUBLISHED = auto()
|
PTX_REFUND_PUBLISHED = auto()
|
||||||
LOCK_TX_B_IN_MEMPOOL = auto()
|
LOCK_TX_B_IN_MEMPOOL = auto()
|
||||||
|
BCH_MERCY_TX_PUBLISHED = auto()
|
||||||
BCH_MERCY_TX_FOUND = auto()
|
BCH_MERCY_TX_FOUND = auto()
|
||||||
|
|
||||||
|
|
||||||
|
@ -456,6 +457,8 @@ def describeEventEntry(event_type, event_msg):
|
||||||
return 'Participate tx refund tx published'
|
return 'Participate tx refund tx published'
|
||||||
if event_type == EventLogTypes.BCH_MERCY_TX_FOUND:
|
if event_type == EventLogTypes.BCH_MERCY_TX_FOUND:
|
||||||
return 'BCH mercy tx found'
|
return 'BCH mercy tx found'
|
||||||
|
if event_type == EventLogTypes.BCH_MERCY_TX_PUBLISHED:
|
||||||
|
return 'Lock tx B mercy tx published'
|
||||||
|
|
||||||
|
|
||||||
def getVoutByAddress(txjs, p2sh):
|
def getVoutByAddress(txjs, p2sh):
|
||||||
|
|
Loading…
Reference in a new issue