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

@@ -72,24 +72,3 @@ def test_get_non_existing_transaction():
tx_info = Carrier.get_transaction(get_random_value_hex(32))
assert tx_info is None
def test_check_tx_in_chain(carrier):
# Let's starts by looking for a random transaction
random_tx = TX.create_dummy_transaction()
random_txid = sha256d(random_tx)
tx_in_chain, confirmations = carrier.check_tx_in_chain(random_txid)
assert tx_in_chain is False and confirmations is None
# We can now broadcast the transaction and check again
carrier.send_transaction(random_tx, random_txid)
tx_in_chain, confirmations = carrier.check_tx_in_chain(random_txid)
# The tx should be on mempool now, so same
assert tx_in_chain is False and confirmations is None
# Finally we can mine a block and check again
generate_block()
tx_in_chain, confirmations = carrier.check_tx_in_chain(random_txid)
assert tx_in_chain is True and confirmations == 1