Fix bug when manually redeeming noscript lock tx with invalid amount.
This commit is contained in:
		
							parent
							
								
									efb0b08ac9
								
							
						
					
					
						commit
						65951220b8
					
				| @ -1,3 +1,3 @@ | ||||
| name = "basicswap" | ||||
| 
 | ||||
| __version__ = "0.0.29" | ||||
| __version__ = "0.0.30" | ||||
|  | ||||
| @ -3074,13 +3074,14 @@ class BasicSwap(BaseApp): | ||||
|                         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) | ||||
| 
 | ||||
|                         block_header = ci_from.getBlockHeaderFromHeight(lock_refund_tx_chain_info['height']) | ||||
|                         refund_tx.block_hash = bytes.fromhex(block_header['hash']) | ||||
|                         refund_tx.block_height = block_header['height'] | ||||
|                         refund_tx.block_time = block_header['time']  # Or median_time? | ||||
|                         if lock_refund_tx_chain_info is not None: | ||||
|                             block_header = ci_from.getBlockHeaderFromHeight(lock_refund_tx_chain_info['height']) | ||||
|                             refund_tx.block_hash = bytes.fromhex(block_header['hash']) | ||||
|                             refund_tx.block_height = block_header['height'] | ||||
|                             refund_tx.block_time = block_header['time']  # Or median_time? | ||||
| 
 | ||||
|                         self.saveBidInSession(bid_id, bid, session, xmr_swap) | ||||
|                         session.commit() | ||||
|                             self.saveBidInSession(bid_id, bid, session, xmr_swap) | ||||
|                             session.commit() | ||||
| 
 | ||||
|         except Exception as ex: | ||||
|             raise ex | ||||
|  | ||||
| @ -975,6 +975,7 @@ class BTCInterface(CoinInterface): | ||||
|                 'height': block_height} | ||||
| 
 | ||||
|         except Exception as e: | ||||
|             self._log.debug('getLockTxHeight gettransaction failed: %s, %s', txid.hex(), str(e)) | ||||
|             return None | ||||
| 
 | ||||
|         if find_index: | ||||
|  | ||||
| @ -406,13 +406,14 @@ class XMRInterface(CoinInterface): | ||||
| 
 | ||||
|             if rv['balance'] < cb_swap_value: | ||||
|                 self._log.warning('Balance is too low, checking for existing spend.') | ||||
|                 txns = self.rpc_wallet_cb('get_transfers', {'out': True})['out'] | ||||
|                 print(txns, txns) | ||||
|                 if len(txns) > 0: | ||||
|                     txid = txns[0]['txid'] | ||||
|                     self._log.warning(f'spendBLockTx detected spending tx: {txid}.') | ||||
|                     if txns[0]['address'] == address_b58: | ||||
|                         return bytes.fromhex(txid) | ||||
|                 txns = self.rpc_wallet_cb('get_transfers', {'out': True}) | ||||
|                 if 'out' in txns: | ||||
|                     txns = txns['out'] | ||||
|                     if len(txns) > 0: | ||||
|                         txid = txns[0]['txid'] | ||||
|                         self._log.warning(f'spendBLockTx detected spending tx: {txid}.') | ||||
|                         if txns[0]['address'] == address_b58: | ||||
|                             return bytes.fromhex(txid) | ||||
| 
 | ||||
|                 self._log.error('wallet {} balance {}, expected {}'.format(wallet_filename, rv['balance'], cb_swap_value)) | ||||
| 
 | ||||
|  | ||||
| @ -33,7 +33,8 @@ def addLockRefundSigs(self, xmr_swap, ci): | ||||
| 
 | ||||
| 
 | ||||
| def recoverNoScriptTxnWithKey(self, bid_id, encoded_key): | ||||
|     # Manually recover txn if  other key is known | ||||
|     self.log.info('Manually recovering %s', bid_id.hex()) | ||||
|     # Manually recover txn if other key is known | ||||
|     session = scoped_session(self.session_factory) | ||||
|     try: | ||||
|         bid, xmr_swap = self.getXmrBidFromSession(session, bid_id) | ||||
|  | ||||
| @ -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 | ||||
| ============== | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user