Skip to content

Commit 93f48fc

Browse files
committed
test: add tx_in_orphanage()
Allows tests to check if a transaction is contained within the orphanage
1 parent 34a9c10 commit 93f48fc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/functional/test_framework/mempool_util.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from .blocktools import (
99
COINBASE_MATURITY,
1010
)
11+
from .messages import CTransaction
1112
from .util import (
1213
assert_equal,
1314
assert_greater_than,
@@ -83,3 +84,8 @@ def send_batch(fee):
8384
test_framework.log.debug("Check that mempoolminfee is larger than minrelaytxfee")
8485
assert_equal(node.getmempoolinfo()['minrelaytxfee'], Decimal('0.00001000'))
8586
assert_greater_than(node.getmempoolinfo()['mempoolminfee'], Decimal('0.00001000'))
87+
88+
def tx_in_orphanage(node, tx: CTransaction) -> bool:
89+
"""Returns true if the transaction is in the orphanage."""
90+
found = [o for o in node.getorphantxs(verbosity=1) if o["txid"] == tx.rehash() and o["wtxid"] == tx.getwtxid()]
91+
return len(found) == 1

0 commit comments

Comments
 (0)