From ec27f33b998a792120cdf3135d2861f7cbffc860 Mon Sep 17 00:00:00 2001 From: kevkevinpal Date: Mon, 21 Oct 2024 20:41:01 -0400 Subject: [PATCH] not sure why its getting stuck --- test/functional/rpc_getorphantxs.py | 34 ++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/test/functional/rpc_getorphantxs.py b/test/functional/rpc_getorphantxs.py index 992b95a30039e5..8c58c5a01812cd 100755 --- a/test/functional/rpc_getorphantxs.py +++ b/test/functional/rpc_getorphantxs.py @@ -129,24 +129,37 @@ def orphan_details_match(self, orphan, tx, verbosity): def test_max_orphan_amount(self): self.log.info("Check that once we reach the max orphan amount we dont get any new orphans") + self.restart_node(0) node = self.nodes[0] + self.log.info(node.getrawmempool()) + self.log.info(node.getorphantxs()) + + peer_1 = node.add_p2p_connection(P2PInterface()) + peer_1.sync_with_ping() + + self.log.info("Check that orphanage is empty on start of test") + orphanage = node.getorphantxs() + self.wait_until(lambda: len(node.getorphantxs()) == 0) self.log.info("Filling up orphanage with " + str(MAX_ORPHANS) + "(MAX_ORPHANS) orphans") orphans = [] - for _ in range(MAX_ORPHANS): - tx_parent_1 = self.wallet.create_self_transfer() - tx_child_1 = self.wallet.create_self_transfer(utxo_to_spend=tx_parent_1["new_utxo"]) - orphans.append(tx_child_1["tx"]) + parent_orphans = [] + for index in range(MAX_ORPHANS): + parent_and_child = self.wallet.create_self_transfer_chain(chain_length=2) + tx_child_1 = parent_and_child[1] + tx_parent_1 = parent_and_child[0] + parent_orphans.append(tx_parent_1) + orphans.append(tx_child_1) peer_1.send_message(msg_tx(tx_child_1["tx"])) + self.wait_until(lambda: len(node.getorphantxs()) == index + 1) - peer_1.sync_with_ping() orphanage = node.getorphantxs() assert_equal(len(orphanage), MAX_ORPHANS) for orphan in orphans: - assert tx_in_orphanage(node, orphan) + assert tx_in_orphanage(node, orphan["tx"]) self.log.info("Check that we do not add more than the max orphan amount") tx_parent_1 = self.wallet.create_self_transfer() @@ -155,5 +168,14 @@ def test_max_orphan_amount(self): orphanage = node.getorphantxs() assert_equal(len(orphanage), MAX_ORPHANS) + self.log.info("Clearing the orphanage") + for index, parent_orphan in enumerate(parent_orphans): + self.wait_until(lambda: len(node.getorphantxs()) == len(parent_orphans) - (index)) + peer_1.send_and_ping(msg_tx(parent_orphan["tx"])) + self.log.info(len(node.getorphantxs())) + self.log.info(parent_orphan) + self.generate(node, 1) + assert_equal(len(node.getorphantxs()),0) + if __name__ == '__main__': GetOrphanTxsTest(__file__).main()