mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-18 06:34:19 +01:00
Updates handle_reorgs and deletes check_tx_in_chain
Updates handle_reorg to work with the current version of the Responder (the old code was outdated and broken). `check_tx_in_chain` was only used by `handle_reorgs`, and made not much sense at this point. The method need to check if the transaction is in mempool or blockchain, so it seems to make more sense bulding on top of `get_transaction`.
This commit is contained in:
@@ -87,21 +87,3 @@ class Carrier:
|
||||
logger.error("JSONRPCException.", method="Carrier.get_transaction", error=e.error)
|
||||
|
||||
return tx_info
|
||||
|
||||
def check_tx_in_chain(self, txid):
|
||||
tx_in_chain = False
|
||||
confirmations = None
|
||||
|
||||
tx_info = self.get_transaction(txid)
|
||||
|
||||
if tx_info is not None:
|
||||
confirmations = int(tx_info.get("confirmations")) if tx_info.get("confirmations") is not None else None
|
||||
|
||||
if confirmations is not None:
|
||||
tx_in_chain = True
|
||||
logger.error("Transaction found in the blockchain", txid=txid)
|
||||
|
||||
else:
|
||||
logger.error("Transaction found in mempool", txid=txid)
|
||||
|
||||
return tx_in_chain, confirmations
|
||||
|
||||
Reference in New Issue
Block a user