mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
merge bitcoin#27986: remove race in the user-agent reception check
This commit is contained in:
parent
1bf135bbc9
commit
fffe6e716b
@ -638,10 +638,13 @@ class TestNode():
|
|||||||
# in comparison to the upside of making tests less fragile and unexpected intermittent errors less likely.
|
# in comparison to the upside of making tests less fragile and unexpected intermittent errors less likely.
|
||||||
p2p_conn.sync_with_ping()
|
p2p_conn.sync_with_ping()
|
||||||
|
|
||||||
# Consistency check that the Dash Core has received our user agent string. This checks the
|
# Consistency check that the node received our user agent string.
|
||||||
# node's newest peer. It could be racy if another Dash Core node has connected since we opened
|
# Find our connection in getpeerinfo by our address:port, as it is unique.
|
||||||
# our connection, but we don't expect that to happen.
|
sockname = p2p_conn._transport.get_extra_info("socket").getsockname()
|
||||||
assert_equal(self.getpeerinfo()[-1]['subver'], p2p_conn.strSubVer)
|
our_addr_and_port = f"{sockname[0]}:{sockname[1]}"
|
||||||
|
info = [peer for peer in self.getpeerinfo() if peer["addr"] == our_addr_and_port]
|
||||||
|
assert_equal(len(info), 1)
|
||||||
|
assert_equal(info[0]["subver"], p2p_conn.strSubVer)
|
||||||
|
|
||||||
return p2p_conn
|
return p2p_conn
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user