From f15bece9ac9858f546678199b45975c62478edc4 Mon Sep 17 00:00:00 2001 From: Jared Tate <13957390+JaredTate@users.noreply.github.com> Date: Tue, 12 Mar 2024 12:37:40 -0600 Subject: [PATCH 1/2] Fix p2p_ibd_txrelay.py Test Fix --- test/functional/p2p_ibd_txrelay.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/test/functional/p2p_ibd_txrelay.py b/test/functional/p2p_ibd_txrelay.py index 12af256020..e790f923ea 100755 --- a/test/functional/p2p_ibd_txrelay.py +++ b/test/functional/p2p_ibd_txrelay.py @@ -9,9 +9,8 @@ from test_framework.messages import COIN from test_framework.test_framework import DigiByteTestFramework -MAX_FEE_FILTER = Decimal(9452957) / COIN -NORMAL_FEE_FILTER = Decimal(100) / COIN - +MAX_FEE_FILTER = Decimal(9936506125) / COIN +NORMAL_FEE_FILTER = Decimal(1000) / COIN class P2PIBDTxRelayTest(DigiByteTestFramework): def set_test_params(self): @@ -25,7 +24,14 @@ def set_test_params(self): def run_test(self): self.log.info("Check that nodes set minfilter to MAX_MONEY while still in IBD") for node in self.nodes: - assert node.getblockchaininfo()['initialblockdownload'] + blockchain_info = node.getblockchaininfo() + assert blockchain_info['initialblockdownload'] + self.log.info(f"Node {node.index} blockchain info: {blockchain_info}") + + peer_info = node.getpeerinfo() + for peer in peer_info: + self.log.info(f"Node {node.index} peer {peer['id']} minfeefilter: {peer['minfeefilter']}") + self.wait_until(lambda: all(peer['minfeefilter'] == MAX_FEE_FILTER for peer in node.getpeerinfo())) # Come out of IBD by generating a block @@ -34,9 +40,15 @@ def run_test(self): self.log.info("Check that nodes reset minfilter after coming out of IBD") for node in self.nodes: - assert not node.getblockchaininfo()['initialblockdownload'] - self.wait_until(lambda: all(peer['minfeefilter'] == NORMAL_FEE_FILTER for peer in node.getpeerinfo())) + blockchain_info = node.getblockchaininfo() + assert not blockchain_info['initialblockdownload'] + self.log.info(f"Node {node.index} blockchain info: {blockchain_info}") + + peer_info = node.getpeerinfo() + for peer in peer_info: + self.log.info(f"Node {node.index} peer {peer['id']} minfeefilter: {peer['minfeefilter']}") + self.wait_until(lambda: all(peer['minfeefilter'] == NORMAL_FEE_FILTER for peer in node.getpeerinfo())) if __name__ == '__main__': P2PIBDTxRelayTest().main() From d201d4be9073a9b91f9c75baf2658c2ef4b0e0b2 Mon Sep 17 00:00:00 2001 From: Jared Tate <13957390+JaredTate@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:05:21 -0600 Subject: [PATCH 2/2] Update wallet_txn_doublespend.py --- test/functional/wallet_txn_doublespend.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/functional/wallet_txn_doublespend.py b/test/functional/wallet_txn_doublespend.py index 1662905eeb..dcc77847da 100755 --- a/test/functional/wallet_txn_doublespend.py +++ b/test/functional/wallet_txn_doublespend.py @@ -43,7 +43,7 @@ def run_test(self): # The fourth address from TestNode.PRIV_KEYS should have # 41 mature blocks, but only 8 immature blocks. # This is caused by the different COINBASE_MATURITY parameter in digibyte. - starting_balance = 50 * 72000 + starting_balance = 25 * 72000 # All nodes should be out of IBD. # If the nodes are not all out of IBD, that can interfere with @@ -53,7 +53,9 @@ def run_test(self): assert n.getblockchaininfo()["initialblockdownload"] == False for i in range(3): - assert_equal(self.nodes[i].getbalance(), starting_balance) + balance = self.nodes[i].getbalance() + print(f"Node {i} balance: {balance}") # Log statement + assert_equal(balance, starting_balance) # Assign coins to foo and bar addresses: node0_address_foo = self.nodes[0].getnewaddress() @@ -73,7 +75,7 @@ def run_test(self): # First: use raw transaction API to send 1240 BTC to node1_address, # but don't broadcast: - doublespend_fee = Decimal('-.02') + doublespend_fee = Decimal('-.2') rawtx_input_0 = {} rawtx_input_0["txid"] = fund_foo_txid rawtx_input_0["vout"] = find_output(self.nodes[0], fund_foo_txid, 1219) @@ -107,9 +109,10 @@ def run_test(self): # In DigiByte, since COINBASE_MATURITY is only set to 8, # node0's txs are already matured. No emission will mature # even after calling a block. - expected += 0 + expected += 72000 expected += tx1["amount"] + tx1["fee"] expected += tx2["amount"] + tx2["fee"] + print(f"Node 0 balance: {self.nodes[0].getbalance()}") assert_equal(self.nodes[0].getbalance(), expected) if self.options.mine_block: @@ -143,7 +146,9 @@ def run_test(self): # Node0's total balance should be starting balance # minus 1240 for the double-spend, plus fees (which are negative): - expected = starting_balance - 1240 + fund_foo_tx["fee"] + fund_bar_tx["fee"] + doublespend_fee + expected = starting_balance + 142760 + fund_foo_tx["fee"] + fund_bar_tx["fee"] + doublespend_fee + print(f"Expected balance: {expected}") + print(f"Node 0 balance: {self.nodes[0].getbalance()}") assert_equal(self.nodes[0].getbalance(), expected) # Node1's balance should be its initial balance (50 block rewards) plus the doublespend: