aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortdb3 <106488469+tdb3@users.noreply.github.com>2024-10-06 19:58:25 -0400
committertdb3 <106488469+tdb3@users.noreply.github.com>2024-10-25 17:11:27 -0400
commit63f5e6ec795f3d5ddfed03f3c51f79ad7a51db1e (patch)
tree4b749702117277ae03eb8ee3b2dba860c965dfa9 /test
parent808a708107e65e52f54373d2e26f807cf1e444e1 (diff)
test: add entry and expiration time checks
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/rpc_orphans.py12
-rw-r--r--test/functional/test_framework/mempool_util.py2
2 files changed, 13 insertions, 1 deletions
diff --git a/test/functional/rpc_orphans.py b/test/functional/rpc_orphans.py
index 802580bc7c..f781cbda40 100755
--- a/test/functional/rpc_orphans.py
+++ b/test/functional/rpc_orphans.py
@@ -4,7 +4,12 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Tests for orphan related RPCs."""
-from test_framework.mempool_util import tx_in_orphanage
+import time
+
+from test_framework.mempool_util import (
+ ORPHAN_TX_EXPIRE_TIME,
+ tx_in_orphanage,
+)
from test_framework.messages import msg_tx
from test_framework.p2p import P2PInterface
from test_framework.util import (
@@ -90,6 +95,8 @@ class OrphanRPCsTest(BitcoinTestFramework):
tx_child_2 = self.wallet.create_self_transfer(utxo_to_spend=tx_parent_2["new_utxo"])
peer_1 = node.add_p2p_connection(P2PInterface())
peer_2 = node.add_p2p_connection(P2PInterface())
+ entry_time = int(time.time())
+ node.setmocktime(entry_time)
peer_1.send_and_ping(msg_tx(tx_child_1["tx"]))
peer_2.send_and_ping(msg_tx(tx_child_2["tx"]))
@@ -109,6 +116,9 @@ class OrphanRPCsTest(BitcoinTestFramework):
assert_equal(len(node.getorphantxs()), 1)
orphan_1 = orphanage[0]
self.orphan_details_match(orphan_1, tx_child_1, verbosity=1)
+ self.log.info("Checking orphan entry/expiration times")
+ assert_equal(orphan_1["entry"], entry_time)
+ assert_equal(orphan_1["expiration"], entry_time + ORPHAN_TX_EXPIRE_TIME)
self.log.info("Checking orphan details (verbosity 2)")
orphanage = node.getorphantxs(verbosity=2)
diff --git a/test/functional/test_framework/mempool_util.py b/test/functional/test_framework/mempool_util.py
index a6a7940c60..94d58b9e7d 100644
--- a/test/functional/test_framework/mempool_util.py
+++ b/test/functional/test_framework/mempool_util.py
@@ -19,6 +19,8 @@ from .wallet import (
MiniWallet,
)
+ORPHAN_TX_EXPIRE_TIME = 1200
+
def fill_mempool(test_framework, node, *, tx_sync_fun=None):
"""Fill mempool until eviction.