Fix bug when manually redeeming noscript lock tx with invalid amount.

This commit is contained in:
tecnovert 2021-12-31 21:34:00 +02:00
parent efb0b08ac9
commit 65951220b8
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
6 changed files with 26 additions and 15 deletions

View file

@ -1,3 +1,3 @@
name = "basicswap" name = "basicswap"
__version__ = "0.0.29" __version__ = "0.0.30"

View file

@ -3074,6 +3074,7 @@ class BasicSwap(BaseApp):
p2wsh_addr = ci_from.encode_p2wsh(a_lock_refund_tx_dest) p2wsh_addr = ci_from.encode_p2wsh(a_lock_refund_tx_dest)
lock_refund_tx_chain_info = ci_from.getLockTxHeight(refund_tx.txid, p2wsh_addr, 0, bid.chain_a_height_start) lock_refund_tx_chain_info = ci_from.getLockTxHeight(refund_tx.txid, p2wsh_addr, 0, bid.chain_a_height_start)
if lock_refund_tx_chain_info is not None:
block_header = ci_from.getBlockHeaderFromHeight(lock_refund_tx_chain_info['height']) block_header = ci_from.getBlockHeaderFromHeight(lock_refund_tx_chain_info['height'])
refund_tx.block_hash = bytes.fromhex(block_header['hash']) refund_tx.block_hash = bytes.fromhex(block_header['hash'])
refund_tx.block_height = block_header['height'] refund_tx.block_height = block_header['height']

View file

@ -975,6 +975,7 @@ class BTCInterface(CoinInterface):
'height': block_height} 'height': block_height}
except Exception as e: except Exception as e:
self._log.debug('getLockTxHeight gettransaction failed: %s, %s', txid.hex(), str(e))
return None return None
if find_index: if find_index:

View file

@ -406,8 +406,9 @@ class XMRInterface(CoinInterface):
if rv['balance'] < cb_swap_value: if rv['balance'] < cb_swap_value:
self._log.warning('Balance is too low, checking for existing spend.') self._log.warning('Balance is too low, checking for existing spend.')
txns = self.rpc_wallet_cb('get_transfers', {'out': True})['out'] txns = self.rpc_wallet_cb('get_transfers', {'out': True})
print(txns, txns) if 'out' in txns:
txns = txns['out']
if len(txns) > 0: if len(txns) > 0:
txid = txns[0]['txid'] txid = txns[0]['txid']
self._log.warning(f'spendBLockTx detected spending tx: {txid}.') self._log.warning(f'spendBLockTx detected spending tx: {txid}.')

View file

@ -33,6 +33,7 @@ def addLockRefundSigs(self, xmr_swap, ci):
def recoverNoScriptTxnWithKey(self, bid_id, encoded_key): def recoverNoScriptTxnWithKey(self, bid_id, encoded_key):
self.log.info('Manually recovering %s', bid_id.hex())
# Manually recover txn if other key is known # Manually recover txn if other key is known
session = scoped_session(self.session_factory) session = scoped_session(self.session_factory)
try: try:

View file

@ -3,6 +3,13 @@
============== ==============
0.0.30
==============
- Core launch log messages are written to disk.
- Fixed bug when manually redeeming noscript lock tx with invalid amount.
0.0.29 0.0.29
============== ==============