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+ )
813from test_framework .messages import msg_tx
914from test_framework .p2p import P2PInterface
1015from 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 )
0 commit comments