merge bitcoin#26519: Add getpeerinfo test for missing version message

Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com>
This commit is contained in:
Kittywhiskers Van Gogh 2024-09-13 10:05:48 +00:00
parent 89a7c60aec
commit 1d77f3ff55
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD

View File

@ -109,6 +109,51 @@ class NetTest(DashTestFramework):
assert_equal(peer_info[2][0]['connection_type'], 'manual')
self.log.info("Check getpeerinfo output before a version message was sent")
no_version_peer_id = 3
no_version_peer_conntime = self.mocktime
with self.nodes[0].assert_debug_log([f"Added connection peer={no_version_peer_id}"]):
self.nodes[0].add_p2p_connection(P2PInterface(), send_version=False, wait_for_verack=False)
peer_info = self.nodes[0].getpeerinfo()[no_version_peer_id]
peer_info.pop("addr")
peer_info.pop("addrbind")
assert_equal(
peer_info,
{
"addr_processed": 0,
"addr_rate_limited": 0,
"addr_relay_enabled": False,
"bip152_hb_from": False,
"bip152_hb_to": False,
"bytesrecv": 0,
"bytesrecv_per_msg": {},
"bytessent": 0,
"bytessent_per_msg": {},
"connection_type": "inbound",
"conntime": no_version_peer_conntime,
"id": no_version_peer_id,
"inbound": True,
"inflight": [],
"last_block": 0,
"last_transaction": 0,
"lastrecv": 0,
"lastsend": 0,
"masternode": False,
"network": "not_publicly_routable",
"permissions": [],
"relaytxes": False,
"services": "0000000000000000",
"servicesnames": [],
"startingheight": -1,
"subver": "",
"synced_blocks": -1,
"synced_headers": -1,
"timeoffset": 0,
"version": 0,
},
)
self.nodes[0].disconnect_p2ps()
def test_getnettotals(self):
self.log.info("Test getnettotals")
# Test getnettotals and getpeerinfo by doing a ping. The bytes