Skip to content

Commit eb7b781

Browse files
committed
modify p2p_feefilter test to catch rounding error
1 parent 6a51f79 commit eb7b781

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

test/functional/p2p_feefilter.py

+16-7
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ def clear_invs(self):
4141
class FeeFilterTest(BitcoinTestFramework):
4242
def set_test_params(self):
4343
self.num_nodes = 2
44+
# We lower the various required feerates for this test
45+
# to catch a corner-case where feefilter used to slightly undercut
46+
# mempool and wallet feerate calculation based on GetFee
47+
# rounding down 3 places, leading to stranded transactions.
48+
# See issue #16499
49+
self.extra_args = [["-minrelaytxfee=0.00000100", "-mintxfee=0.00000100"]]*self.num_nodes
4450

4551
def skip_test_if_missing_module(self):
4652
self.skip_if_no_wallet()
@@ -54,22 +60,25 @@ def run_test(self):
5460

5561
self.nodes[0].add_p2p_connection(TestP2PConn())
5662

57-
# Test that invs are received for all txs at feerate of 20 sat/byte
58-
node1.settxfee(Decimal("0.00020000"))
63+
# Test that invs are received by test connection for all txs at
64+
# feerate of .2 sat/byte
65+
node1.settxfee(Decimal("0.00000200"))
5966
txids = [node1.sendtoaddress(node1.getnewaddress(), 1) for x in range(3)]
6067
assert allInvsMatch(txids, self.nodes[0].p2p)
6168
self.nodes[0].p2p.clear_invs()
6269

63-
# Set a filter of 15 sat/byte
64-
self.nodes[0].p2p.send_and_ping(msg_feefilter(15000))
70+
# Set a filter of .15 sat/byte on test connection
71+
self.nodes[0].p2p.send_and_ping(msg_feefilter(150))
6572

66-
# Test that txs are still being received (paying 20 sat/byte)
73+
# Test that txs are still being received by test connection (paying .15 sat/byte)
74+
node1.settxfee(Decimal("0.00000150"))
6775
txids = [node1.sendtoaddress(node1.getnewaddress(), 1) for x in range(3)]
6876
assert allInvsMatch(txids, self.nodes[0].p2p)
6977
self.nodes[0].p2p.clear_invs()
7078

71-
# Change tx fee rate to 10 sat/byte and test they are no longer received
72-
node1.settxfee(Decimal("0.00010000"))
79+
# Change tx fee rate to .1 sat/byte and test they are no longer received
80+
# by the test connection
81+
node1.settxfee(Decimal("0.00000100"))
7382
[node1.sendtoaddress(node1.getnewaddress(), 1) for x in range(3)]
7483
self.sync_mempools() # must be sure node 0 has received all txs
7584

0 commit comments

Comments
 (0)