mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 03:47:29 -03:00
test: check for specific disconnect reasons in feature_maxuploadtarget.py
This ensures that the disconnect happens for the expected reason and also makes it easier to navigate between implementation and test code, i.e. both the questions "do we have test coverage for this disconnect?" (from an implementation reader's perspective) and "where is the code handling this disconnect?" (from a test reader's perspective) can be answered simply by grep-ping the corresponding debug message.
This commit is contained in:
parent
73d7372115
commit
dd5cf38818
1 changed files with 7 additions and 5 deletions
|
@ -119,6 +119,7 @@ class MaxUploadTest(BitcoinTestFramework):
|
|||
assert_equal(len(self.nodes[0].getpeerinfo()), 3)
|
||||
# At most a couple more tries should succeed (depending on how long
|
||||
# the test has been running so far).
|
||||
with self.nodes[0].assert_debug_log(expected_msgs=["historical block serving limit reached, disconnect peer"]):
|
||||
for _ in range(3):
|
||||
p2p_conns[0].send_message(getdata_request)
|
||||
p2p_conns[0].wait_for_disconnect()
|
||||
|
@ -143,6 +144,7 @@ class MaxUploadTest(BitcoinTestFramework):
|
|||
|
||||
# But if p2p_conns[1] tries for an old block, it gets disconnected too.
|
||||
getdata_request.inv = [CInv(MSG_BLOCK, big_old_block)]
|
||||
with self.nodes[0].assert_debug_log(expected_msgs=["historical block serving limit reached, disconnect peer"]):
|
||||
p2p_conns[1].send_message(getdata_request)
|
||||
p2p_conns[1].wait_for_disconnect()
|
||||
assert_equal(len(self.nodes[0].getpeerinfo()), 1)
|
||||
|
|
Loading…
Reference in a new issue