File tree 5 files changed +38
-5
lines changed
5 files changed +38
-5
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,10 @@ def set_test_params(self):
18
18
self .num_nodes = 2
19
19
20
20
def run_test (self ):
21
+ self .log .info ("Connect nodes both way" )
22
+ connect_nodes (self .nodes [0 ], 1 )
23
+ connect_nodes (self .nodes [1 ], 0 )
24
+
21
25
self .log .info ("Test setban and listbanned RPCs" )
22
26
23
27
self .log .info ("setban: successfully ban single IP address" )
@@ -74,7 +78,9 @@ def run_test(self):
74
78
75
79
# Clear ban lists
76
80
self .nodes [1 ].clearbanned ()
77
- connect_nodes_bi (self .nodes , 0 , 1 )
81
+ self .log .info ("Connect nodes both way" )
82
+ connect_nodes (self .nodes [0 ], 1 )
83
+ connect_nodes (self .nodes [1 ], 0 )
78
84
79
85
self .log .info ("Test disconnectnode RPCs" )
80
86
Original file line number Diff line number Diff line change @@ -121,6 +121,7 @@ def test_inv_block(self):
121
121
# peer, plus
122
122
# * the first time it is re-requested from the outbound peer, plus
123
123
# * 2 seconds to avoid races
124
+ assert self .nodes [1 ].getpeerinfo ()[0 ]['inbound' ] == False
124
125
timeout = 2 + (MAX_GETDATA_RANDOM_DELAY + INBOUND_PEER_TX_DELAY ) + (
125
126
GETDATA_TX_INTERVAL + MAX_GETDATA_RANDOM_DELAY )
126
127
self .log .info ("Tx should be received at node 1 after {} seconds" .format (timeout ))
Original file line number Diff line number Diff line change @@ -54,6 +54,10 @@ def set_test_params(self):
54
54
self .extra_args = [["-minrelaytxfee=0.00001000" ],["-minrelaytxfee=0.00000500" ]]
55
55
56
56
def run_test (self ):
57
+ self .log .info ('Connect nodes both way' )
58
+ connect_nodes (self .nodes [0 ], 1 )
59
+ connect_nodes (self .nodes [1 ], 0 )
60
+
57
61
self ._test_connection_count ()
58
62
self ._test_getnettotals ()
59
63
self ._test_getnetworkinfo ()
@@ -105,7 +109,10 @@ def _test_getnetworkinfo(self):
105
109
wait_until (lambda : self .nodes [0 ].getnetworkinfo ()['connections' ] == 0 , timeout = 3 )
106
110
107
111
self .nodes [0 ].setnetworkactive (state = True )
108
- connect_nodes_bi (self .nodes , 0 , 1 )
112
+ self .log .info ('Connect nodes both way' )
113
+ connect_nodes (self .nodes [0 ], 1 )
114
+ connect_nodes (self .nodes [1 ], 0 )
115
+
109
116
assert_equal (self .nodes [0 ].getnetworkinfo ()['networkactive' ], True )
110
117
assert_equal (self .nodes [0 ].getnetworkinfo ()['connections' ], 2 )
111
118
Original file line number Diff line number Diff line change @@ -281,8 +281,18 @@ def setup_network(self):
281
281
# Connect the nodes as a "chain". This allows us
282
282
# to split the network between nodes 1 and 2 to get
283
283
# two halves that can work on competing chains.
284
+ #
285
+ # Topology looks like this:
286
+ # node0 <-- node1 <-- node2 <-- node3
287
+ #
288
+ # If all nodes are in IBD (clean chain from genesis), node0 is assumed to be the source of blocks (miner). To
289
+ # ensure block propagation, all nodes will establish outgoing connections toward node0.
290
+ # See fPreferredDownload in net_processing.
291
+ #
292
+ # If further outbound connections are needed, they can be added at the beginning of the test with e.g.
293
+ # connect_nodes(self.nodes[1], 2)
284
294
for i in range (self .num_nodes - 1 ):
285
- connect_nodes_bi (self .nodes , i , i + 1 )
295
+ connect_nodes (self .nodes [ i + 1 ], i )
286
296
self .sync_all ()
287
297
288
298
def setup_nodes (self ):
Original file line number Diff line number Diff line change 5
5
"""Test the listsincelast RPC."""
6
6
7
7
from test_framework .test_framework import BitcoinTestFramework
8
- from test_framework .util import assert_equal , assert_array_result , assert_raises_rpc_error
8
+ from test_framework .util import (
9
+ assert_array_result ,
10
+ assert_equal ,
11
+ assert_raises_rpc_error ,
12
+ connect_nodes ,
13
+ )
9
14
10
- class ListSinceBlockTest (BitcoinTestFramework ):
15
+
16
+ class ListSinceBlockTest (BitcoinTestFramework ):
11
17
def set_test_params (self ):
12
18
self .num_nodes = 4
13
19
self .setup_clean_chain = True
@@ -16,6 +22,9 @@ def skip_test_if_missing_module(self):
16
22
self .skip_if_no_wallet ()
17
23
18
24
def run_test (self ):
25
+ # All nodes are in IBD from genesis, so they'll need the miner (node2) to be an outbound connection, or have
26
+ # only one connection. (See fPreferredDownload in net_processing)
27
+ connect_nodes (self .nodes [1 ], 2 )
19
28
self .nodes [2 ].generate (101 )
20
29
self .sync_all ()
21
30
You can’t perform that action at this time.
0 commit comments