diff options
author | tdb3 <106488469+tdb3@users.noreply.github.com> | 2024-09-18 12:29:55 -0400 |
---|---|---|
committer | tdb3 <106488469+tdb3@users.noreply.github.com> | 2024-10-02 18:23:27 -0400 |
commit | 93f48fceb7dd332ef980ce890ff7750b995d6077 (patch) | |
tree | 62212426480aeefd611c4606b7f50dbc8f062b61 | |
parent | 34a9c10e8cdb3e9cd40fc3a420df8f73e0208a48 (diff) |
test: add tx_in_orphanage()
Allows tests to check if a transaction
is contained within the orphanage
-rw-r--r-- | test/functional/test_framework/mempool_util.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/functional/test_framework/mempool_util.py b/test/functional/test_framework/mempool_util.py index fe47123e13..a6a7940c60 100644 --- a/test/functional/test_framework/mempool_util.py +++ b/test/functional/test_framework/mempool_util.py @@ -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 |