4
4
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
5
"""Tests for orphan related RPCs."""
6
6
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
+ )
8
13
from test_framework .messages import msg_tx
9
14
from test_framework .p2p import P2PInterface
10
15
from test_framework .util import (
@@ -90,6 +95,8 @@ def test_orphan_details(self):
90
95
tx_child_2 = self .wallet .create_self_transfer (utxo_to_spend = tx_parent_2 ["new_utxo" ])
91
96
peer_1 = node .add_p2p_connection (P2PInterface ())
92
97
peer_2 = node .add_p2p_connection (P2PInterface ())
98
+ entry_time = int (time .time ())
99
+ node .setmocktime (entry_time )
93
100
peer_1 .send_and_ping (msg_tx (tx_child_1 ["tx" ]))
94
101
peer_2 .send_and_ping (msg_tx (tx_child_2 ["tx" ]))
95
102
@@ -109,6 +116,9 @@ def test_orphan_details(self):
109
116
assert_equal (len (node .getorphantxs ()), 1 )
110
117
orphan_1 = orphanage [0 ]
111
118
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 )
112
122
113
123
self .log .info ("Checking orphan details (verbosity 2)" )
114
124
orphanage = node .getorphantxs (verbosity = 2 )
0 commit comments