Skip to content

Commit 63f5e6e

Browse files
committed
test: add entry and expiration time checks
1 parent 808a708 commit 63f5e6e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

test/functional/rpc_orphans.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Tests for orphan related RPCs."""
66

7-
from test_framework.mempool_util import tx_in_orphanage
7+
import time
8+
9+
from test_framework.mempool_util import (
10+
ORPHAN_TX_EXPIRE_TIME,
11+
tx_in_orphanage,
12+
)
813
from test_framework.messages import msg_tx
914
from test_framework.p2p import P2PInterface
1015
from test_framework.util import (
@@ -90,6 +95,8 @@ def test_orphan_details(self):
9095
tx_child_2 = self.wallet.create_self_transfer(utxo_to_spend=tx_parent_2["new_utxo"])
9196
peer_1 = node.add_p2p_connection(P2PInterface())
9297
peer_2 = node.add_p2p_connection(P2PInterface())
98+
entry_time = int(time.time())
99+
node.setmocktime(entry_time)
93100
peer_1.send_and_ping(msg_tx(tx_child_1["tx"]))
94101
peer_2.send_and_ping(msg_tx(tx_child_2["tx"]))
95102

@@ -109,6 +116,9 @@ def test_orphan_details(self):
109116
assert_equal(len(node.getorphantxs()), 1)
110117
orphan_1 = orphanage[0]
111118
self.orphan_details_match(orphan_1, tx_child_1, verbosity=1)
119+
self.log.info("Checking orphan entry/expiration times")
120+
assert_equal(orphan_1["entry"], entry_time)
121+
assert_equal(orphan_1["expiration"], entry_time + ORPHAN_TX_EXPIRE_TIME)
112122

113123
self.log.info("Checking orphan details (verbosity 2)")
114124
orphanage = node.getorphantxs(verbosity=2)

test/functional/test_framework/mempool_util.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
MiniWallet,
2020
)
2121

22+
ORPHAN_TX_EXPIRE_TIME = 1200
23+
2224

2325
def fill_mempool(test_framework, node, *, tx_sync_fun=None):
2426
"""Fill mempool until eviction.

0 commit comments

Comments
 (0)