Skip to content

Commit

Permalink
test: Replace self.nodes[0].p2p with conn
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoFalke committed Jun 21, 2020
1 parent faccdc8 commit ffff3fe
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions test/functional/p2p_feefilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,23 @@ def run_test(self):
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
Expand All @@ -91,14 +91,14 @@ def run_test(self):
# 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__':
Expand Down

0 comments on commit ffff3fe

Please sign in to comment.