v31.1-roots.1 · Commit 5: [PATCH 05/17] feat(net): preserve Roots peer controls and health view on v31
test/functional/rpc_getblockfrompeer.py
Before: test/functional/rpc_getblockfrompeer.py · After: test/functional/rpc_getblockfrompeer.py
File metadata
index 841cde0219733e35caee9b232281d1235a73abbc..585582bc57bc7701ed67bd063659962438c4f87a 100755
Download original patch · Release notes
Diff rows 1–13 of 13. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
test/functional/rpc_getblockfrompeer.py
CHANGED
|
@@ -87,6 +87,13 @@ class GetBlockFromPeerTest(BitcoinTestFramework):
|
|
| 87 |
presegwit_peer_id = peers[1]["id"]
|
| 88 |
assert_raises_rpc_error(-1, "Pre-SegWit peer", self.nodes[0].getblockfrompeer, short_tip, presegwit_peer_id)
|
| 89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
self.log.info("Successful fetch")
|
| 91 |
result = self.nodes[0].getblockfrompeer(short_tip, peer_0_peer_1_id)
|
| 92 |
self.wait_until(lambda: self.check_for_block(node=0, hash=short_tip), timeout=1)
|
|
|
|
| 87 |
presegwit_peer_id = peers[1]["id"]
|
| 88 |
assert_raises_rpc_error(-1, "Pre-SegWit peer", self.nodes[0].getblockfrompeer, short_tip, presegwit_peer_id)
|
| 89 |
|
| 90 |
+
self.log.info("Duplicate manual fetch from the same peer is rejected without resetting tracking")
|
| 91 |
+
stalled_peer = self.nodes[0].add_p2p_connection(P2PInterface())
|
| 92 |
+
stalled_id = self.nodes[0].getpeerinfo()[-1]['id']
|
| 93 |
+
assert_equal(self.nodes[0].getblockfrompeer(short_tip, stalled_id), {})
|
| 94 |
+
stalled_peer.sync_with_ping()
|
| 95 |
+
assert_raises_rpc_error(-1, "Already requested from this peer", self.nodes[0].getblockfrompeer, short_tip, stalled_id)
|
| 96 |
+
|
| 97 |
self.log.info("Successful fetch")
|
| 98 |
result = self.nodes[0].getblockfrompeer(short_tip, peer_0_peer_1_id)
|
| 99 |
self.wait_until(lambda: self.check_for_block(node=0, hash=short_tip), timeout=1)
|