Skip to content

Commit

Permalink
test: fix addnode functional test failure on OpenBSD
Browse files Browse the repository at this point in the history
This is the functional test counterpart of PR bitcoin#28891 /
commit 007d6f0.
  • Loading branch information
theStack committed Dec 8, 2023
1 parent 3e69125 commit fd0bde2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/functional/rpc_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from decimal import Decimal
from itertools import product
import platform
import time

import test_framework.messages
Expand Down Expand Up @@ -220,8 +221,10 @@ def test_addnode_getaddednodeinfo(self):
ip_port = "127.0.0.1:{}".format(p2p_port(2))
self.nodes[0].addnode(node=ip_port, command='add')
# try to add an equivalent ip
ip_port2 = "127.1:{}".format(p2p_port(2))
assert_raises_rpc_error(-23, "Node already added", self.nodes[0].addnode, node=ip_port2, command='add')
# (note that OpenBSD doesn't support the IPv4 shorthand notation with omitted zero-bytes)
if platform.system() != "OpenBSD":
ip_port2 = "127.1:{}".format(p2p_port(2))
assert_raises_rpc_error(-23, "Node already added", self.nodes[0].addnode, node=ip_port2, command='add')
# check that the node has indeed been added
added_nodes = self.nodes[0].getaddednodeinfo()
assert_equal(len(added_nodes), 1)
Expand Down

0 comments on commit fd0bde2

Please sign in to comment.