Prevent multiple LOCK_TX_B_SEEN events, use rpcwallet for lockunspent.

2024-05-20_merge
tecnovert 11 months ago
parent 1ec1764012
commit d57366c0b2
No known key found for this signature in database
GPG Key ID: 8ED6D8750C4E3F93
  1. 2
      basicswap/__init__.py
  2. 2
      basicswap/basicswap.py
  3. 3
      basicswap/basicswap_util.py
  4. 2
      basicswap/interface/btc.py

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

@ -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()))

@ -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:

@ -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()])

Loading…
Cancel
Save