@@ -237,28 +237,35 @@ def test_getnetworkinfo(self):
237237 def test_addnode_getaddednodeinfo (self ):
238238 self .log .info ("Test addnode and getaddednodeinfo" )
239239 assert_equal (self .nodes [0 ].getaddednodeinfo (), [])
240- # add a node (node2) to node0
240+ self . log . info ( "Add a node (node2) to node0" )
241241 ip_port = "127.0.0.1:{}" .format (p2p_port (2 ))
242242 self .nodes [0 ].addnode (node = ip_port , command = 'add' )
243- # try to add an equivalent ip
244- # ( note that OpenBSD doesn't support the IPv4 shorthand notation with omitted zero-bytes)
243+ self . log . info ( "Try to add an equivalent ip and check it fails" )
244+ self . log . debug ( "( note that OpenBSD doesn't support the IPv4 shorthand notation with omitted zero-bytes)" )
245245 if platform .system () != "OpenBSD" :
246246 ip_port2 = "127.1:{}" .format (p2p_port (2 ))
247247 assert_raises_rpc_error (- 23 , "Node already added" , self .nodes [0 ].addnode , node = ip_port2 , command = 'add' )
248- # check that the node has indeed been added
248+ self . log . info ( "Check that the node has indeed been added" )
249249 added_nodes = self .nodes [0 ].getaddednodeinfo ()
250250 assert_equal (len (added_nodes ), 1 )
251251 assert_equal (added_nodes [0 ]['addednode' ], ip_port )
252- # check that node cannot be added again
252+ self .log .info ("Check that filtering by node works" )
253+ self .nodes [0 ].addnode (node = "11.22.33.44" , command = 'add' )
254+ first_added_node = self .nodes [0 ].getaddednodeinfo (node = ip_port )
255+ assert_equal (added_nodes , first_added_node )
256+ assert_equal (len (self .nodes [0 ].getaddednodeinfo ()), 2 )
257+ self .log .info ("Check that node cannot be added again" )
253258 assert_raises_rpc_error (- 23 , "Node already added" , self .nodes [0 ].addnode , node = ip_port , command = 'add' )
254- # check that node can be removed
259+ self . log . info ( "Check that node can be removed" )
255260 self .nodes [0 ].addnode (node = ip_port , command = 'remove' )
256- assert_equal (self .nodes [0 ].getaddednodeinfo (), [])
257- # check that an invalid command returns an error
261+ added_nodes = self .nodes [0 ].getaddednodeinfo ()
262+ assert_equal (len (added_nodes ), 1 )
263+ assert_equal (added_nodes [0 ]['addednode' ], "11.22.33.44" )
264+ self .log .info ("Check that an invalid command returns an error" )
258265 assert_raises_rpc_error (- 1 , 'addnode "node" "command"' , self .nodes [0 ].addnode , node = ip_port , command = 'abc' )
259- # check that trying to remove the node again returns an error
266+ self . log . info ( "Check that trying to remove the node again returns an error" )
260267 assert_raises_rpc_error (- 24 , "Node could not be removed" , self .nodes [0 ].addnode , node = ip_port , command = 'remove' )
261- # check that a non-existent node returns an error
268+ self . log . info ( "Check that a non-existent node returns an error" )
262269 assert_raises_rpc_error (- 24 , "Node has not been added" , self .nodes [0 ].getaddednodeinfo , '1.1.1.1' )
263270
264271 def test_service_flags (self ):
0 commit comments