mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-04 12:42:05 +02:00
test: Replace self.nodes[0].p2p with conn
This commit is contained in:
@ -58,23 +58,23 @@ class FeeFilterTest(BitcoinTestFramework):
|
||||
node1 = self.nodes[1]
|
||||
node0 = self.nodes[0]
|
||||
|
||||
self.nodes[0].add_p2p_connection(TestP2PConn())
|
||||
conn = self.nodes[0].add_p2p_connection(TestP2PConn())
|
||||
|
||||
# Test that invs are received by test connection for all txs at
|
||||
# feerate of .2 sat/byte
|
||||
node1.settxfee(Decimal("0.00000200"))
|
||||
txids = [node1.sendtoaddress(node1.getnewaddress(), 1) for x in range(3)]
|
||||
assert allInvsMatch(txids, self.nodes[0].p2p)
|
||||
self.nodes[0].p2p.clear_invs()
|
||||
assert allInvsMatch(txids, conn)
|
||||
conn.clear_invs()
|
||||
|
||||
# Set a filter of .15 sat/byte on test connection
|
||||
self.nodes[0].p2p.send_and_ping(msg_feefilter(150))
|
||||
conn.send_and_ping(msg_feefilter(150))
|
||||
|
||||
# Test that txs are still being received by test connection (paying .15 sat/byte)
|
||||
node1.settxfee(Decimal("0.00000150"))
|
||||
txids = [node1.sendtoaddress(node1.getnewaddress(), 1) for x in range(3)]
|
||||
assert allInvsMatch(txids, self.nodes[0].p2p)
|
||||
self.nodes[0].p2p.clear_invs()
|
||||
assert allInvsMatch(txids, conn)
|
||||
conn.clear_invs()
|
||||
|
||||
# Change tx fee rate to .1 sat/byte and test they are no longer received
|
||||
# by the test connection
|
||||
@ -91,14 +91,14 @@ class FeeFilterTest(BitcoinTestFramework):
|
||||
# as well.
|
||||
node0.settxfee(Decimal("0.00020000"))
|
||||
txids = [node0.sendtoaddress(node0.getnewaddress(), 1)]
|
||||
assert allInvsMatch(txids, self.nodes[0].p2p)
|
||||
self.nodes[0].p2p.clear_invs()
|
||||
assert allInvsMatch(txids, conn)
|
||||
conn.clear_invs()
|
||||
|
||||
# Remove fee filter and check that txs are received again
|
||||
self.nodes[0].p2p.send_and_ping(msg_feefilter(0))
|
||||
conn.send_and_ping(msg_feefilter(0))
|
||||
txids = [node1.sendtoaddress(node1.getnewaddress(), 1) for x in range(3)]
|
||||
assert allInvsMatch(txids, self.nodes[0].p2p)
|
||||
self.nodes[0].p2p.clear_invs()
|
||||
assert allInvsMatch(txids, conn)
|
||||
conn.clear_invs()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Reference in New Issue
Block a user