Prevent multiple LOCK_TX_B_SEEN events, use rpcwallet for lockunspent.

This commit is contained in:
tecnovert 2024-02-01 00:58:14 +02:00
parent 1ec1764012
commit d57366c0b2
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
4 changed files with 6 additions and 3 deletions

View file

@ -1,3 +1,3 @@
name = "basicswap"
__version__ = "0.12.5"
__version__ = "0.12.6"

View file

@ -3534,7 +3534,7 @@ class BasicSwap(BaseApp):
self.logBidEvent(bid.bid_id, EventLogTypes.LOCK_TX_B_INVALID, 'Detected invalid lock tx B', session)
bid_changed = True
elif found_tx is not None:
if bid.xmr_b_lock_tx is None or not bid.xmr_b_lock_tx.chain_height:
if found_tx['height'] != 0 and (bid.xmr_b_lock_tx is None or not bid.xmr_b_lock_tx.chain_height):
self.logBidEvent(bid.bid_id, EventLogTypes.LOCK_TX_B_SEEN, '', session)
if bid.xmr_b_lock_tx is None:
self.log.debug('Found {} lock tx in chain'.format(ci_to.coin_name()))

View file

@ -180,6 +180,7 @@ class EventLogTypes(IntEnum):
PTX_PUBLISHED = auto()
PTX_REDEEM_PUBLISHED = auto()
PTX_REFUND_PUBLISHED = auto()
LOCK_TX_B_IN_MEMPOOL = auto()
class XmrSplitMsgTypes(IntEnum):
@ -391,6 +392,8 @@ def describeEventEntry(event_type, event_msg):
return 'Lock tx B seen in chain'
if event_type == EventLogTypes.LOCK_TX_B_CONFIRMED:
return 'Lock tx B confirmed in chain'
if event_type == EventLogTypes.LOCK_TX_B_IN_MEMPOOL:
return 'Lock tx B seen in mempool'
if event_type == EventLogTypes.DEBUG_TWEAK_APPLIED:
return 'Debug tweak applied ' + event_msg
if event_type == EventLogTypes.FAILED_TX_B_REFUND:

View file

@ -981,7 +981,7 @@ class BTCInterface(CoinInterface):
inputs = []
for pi in tx.vin:
inputs.append({'txid': i2h(pi.prevout.hash), 'vout': pi.prevout.n})
self.rpc('lockunspent', [True, inputs])
self.rpc_wallet('lockunspent', [True, inputs])
def signTxWithWallet(self, tx: bytes) -> bytes:
rv = self.rpc_wallet('signrawtransactionwithwallet', [tx.hex()])