mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 10:19:26 +02:00
Remove duplicate method definitions in NodeConnCB subclasses
All Node classes in individual test cases subclass from NodeConnCB. Many have duplicate definitions for methods that are defined in the base class. This commit removes those duplicate definitions. This commit removes ~290 lines of duplicate code.
This commit is contained in:
@ -22,8 +22,6 @@ def allInvsMatch(invsExpected, testnode):
|
||||
time.sleep(1)
|
||||
return False
|
||||
|
||||
# TestNode: bare-bones "peer". Used to track which invs are received from a node
|
||||
# and to send the node feefilter messages.
|
||||
class TestNode(NodeConnCB):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
@ -38,10 +36,6 @@ class TestNode(NodeConnCB):
|
||||
with mininode_lock:
|
||||
self.txinvs = []
|
||||
|
||||
def send_filter(self, feerate):
|
||||
self.send_message(msg_feefilter(feerate))
|
||||
self.sync_with_ping()
|
||||
|
||||
class FeeFilterTest(BitcoinTestFramework):
|
||||
|
||||
def __init__(self):
|
||||
@ -78,7 +72,7 @@ class FeeFilterTest(BitcoinTestFramework):
|
||||
test_node.clear_invs()
|
||||
|
||||
# Set a filter of 15 sat/byte
|
||||
test_node.send_filter(15000)
|
||||
test_node.send_and_ping(msg_feefilter(15000))
|
||||
|
||||
# Test that txs are still being received (paying 20 sat/byte)
|
||||
txids = [node1.sendtoaddress(node1.getnewaddress(), 1) for x in range(3)]
|
||||
@ -103,7 +97,7 @@ class FeeFilterTest(BitcoinTestFramework):
|
||||
test_node.clear_invs()
|
||||
|
||||
# Remove fee filter and check that txs are received again
|
||||
test_node.send_filter(0)
|
||||
test_node.send_and_ping(msg_feefilter(0))
|
||||
txids = [node1.sendtoaddress(node1.getnewaddress(), 1) for x in range(3)]
|
||||
assert(allInvsMatch(txids, test_node))
|
||||
test_node.clear_invs()
|
||||
|
Reference in New Issue
Block a user