test: add tx_in_orphanage()

Allows tests to check if a transaction
is contained within the orphanage
pull/30793/head
tdb3 2 months ago
parent 34a9c10e8c
commit 93f48fceb7
No known key found for this signature in database

@ -8,6 +8,7 @@ from decimal import Decimal
from .blocktools import (
COINBASE_MATURITY,
)
from .messages import CTransaction
from .util import (
assert_equal,
assert_greater_than,
@ -83,3 +84,8 @@ def fill_mempool(test_framework, node, *, tx_sync_fun=None):
test_framework.log.debug("Check that mempoolminfee is larger than minrelaytxfee")
assert_equal(node.getmempoolinfo()['minrelaytxfee'], Decimal('0.00001000'))
assert_greater_than(node.getmempoolinfo()['mempoolminfee'], Decimal('0.00001000'))
def tx_in_orphanage(node, tx: CTransaction) -> bool:
"""Returns true if the transaction is in the orphanage."""
found = [o for o in node.getorphantxs(verbosity=1) if o["txid"] == tx.rehash() and o["wtxid"] == tx.getwtxid()]
return len(found) == 1

Loading…
Cancel
Save