Skip to content

Commit

Permalink
not sure why its getting stuck
Browse files Browse the repository at this point in the history
  • Loading branch information
kevkevinpal committed Oct 22, 2024
1 parent 60dbd42 commit ec27f33
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions test/functional/rpc_getorphantxs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()

0 comments on commit ec27f33

Please sign in to comment.