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:
Sergi Delgado Segura
2019-11-20 15:32:04 +00:00
parent 3dad5b7c71
commit 2183c57f53
3 changed files with 26 additions and 64 deletions

View File

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