Skip to content

Conversation

@jnewbery
Copy link
Contributor

@jnewbery jnewbery commented Mar 17, 2017

EDIT: we can remove the maxblocksinflight test entirely. See #10023 (comment)

maxblocksinflight.py had a very strange structure where the
fucntionality of the test was a method of the NodeConnCB object. This
commit tidies up the structure of the test and brings it in line with
the other functional tests.

@fanquake fanquake added the Tests label Mar 18, 2017
@fanquake
Copy link
Member

Needs a rebase.

@jnewbery jnewbery force-pushed the improvemaxblocksinflight branch from 42ad944 to 84e101d Compare April 12, 2017 14:00
@jnewbery
Copy link
Contributor Author

rebased

@sdaftuar
Copy link
Member

Restructuring this sounds good, but now that we don't send getdata's in response to inv's anymore, perhaps this test should be rewritten to use headers for announcements instead?

@jnewbery
Copy link
Contributor Author

You're correct. On closer inspection, this test case is actually testing nothing. The only thing it asserts on is that the node hasn't sent us too many getdata requests, but since nodes no longer sends getdata messages in response to block invs, it's just testing that 0 < 256:

./maxblocksinflight.py
2017-04-12 22:07:31.285000 TestFramework (INFO): Initializing test directory /tmp/user/1000/testk493pd32/12847
2017-04-12 22:07:31.563000 TestFramework.mininode (INFO): Connecting to Bitcoin Node: 127.0.0.1:13956
2017-04-12 22:07:33.574000 TestFramework (INFO): Round 0: success (total requests: 0)
2017-04-12 22:07:35.577000 TestFramework (INFO): Round 1: success (total requests: 0)
2017-04-12 22:07:37.582000 TestFramework (INFO): Round 2: success (total requests: 0)
2017-04-12 22:07:39.611000 TestFramework (INFO): Round 3: success (total requests: 0)
2017-04-12 22:07:39.611000 TestFramework (INFO): Stopping nodes

the headers-first sync'ing is covered pretty well by sendheaders.py. Should we just retire this test case?

@sdaftuar
Copy link
Member

Well, I'd say that if it's not too much work, we should just fix this test case to test the maxblocksinflight behavior correctly. Ie, announce 17 or more block headers, and verify we only get 16 getdata requests.

@jnewbery
Copy link
Contributor Author

This line:

test_node.wait_for_getdata([x.sha256 for x in blocks[2:16]], timeout=direct_fetch_response_time)
and the block below test that when there are more than 16 headers messages sent, the peer will only send get_data for 16 of them.

I think that covers the maxblocksinflight test, but let me know if you think it needs expanding.

maxblocksinflight tested that a node would not send get_data messages
for more than 16 new blocks at the same time. bitcoin core no longer
responds to block invs with get_data, since it does headers-first
sync'ing. This test was therefore testing nothing and can be removed.

the sendheaders test script tests that bitcoin will not send get_headers
for more than 16 blocks simultaneously.
@jnewbery jnewbery force-pushed the improvemaxblocksinflight branch from 84e101d to 5f4bcf2 Compare April 13, 2017 15:51
@jnewbery
Copy link
Contributor Author

@sdaftuar - as discussed, we can remove maxblocksinflight entirely.

@jnewbery jnewbery changed the title Improve maxblocksinflight.py [tests] remove maxblocksinflight.py (functionality covered by other test) Apr 13, 2017
Copy link
Contributor

@jimmysong jimmysong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 5f4bcf2

This removes a test that doesn't do anything.

for inv in message.inv:
if inv.hash not in self.blockReqCounts:
self.blockReqCounts[inv.hash] = 0
self.blockReqCounts[inv.hash] += 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm understanding correctly, this method doesn't get called anymore since getdata isn't the response to inv?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct


total_requests = 0
with mininode_lock:
for key in self.blockReqCounts:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this should be an empty dict, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

total_requests += self.blockReqCounts[key]
if self.blockReqCounts[key] > 1:
raise AssertionError("Error, test failed: block %064x requested more than once" % key)
if total_requests > MAX_REQUESTS:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And finally, total_requests is 0 every time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exactly, and 0 <= 128 last time I checked, so this test always passes.

@maflcko maflcko merged commit 5f4bcf2 into bitcoin:master Apr 23, 2017
maflcko pushed a commit that referenced this pull request Apr 23, 2017
…red by other test)

5f4bcf2 [tests] Remove maxblocksinflight testcase (John Newbery)

Tree-SHA512: 827c8b12f4b52684a973bbfc508c5906e640572e22a96b9420a7aea86ad8d4aa4d6fcc2bb091f747e2fdd18c897e0456baff254bd5e3ceaf721bd3f09a2fd60b
@jnewbery jnewbery deleted the improvemaxblocksinflight branch April 25, 2017 13:10
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 8, 2019
…ty covered by other test)

5f4bcf2 [tests] Remove maxblocksinflight testcase (John Newbery)

Tree-SHA512: 827c8b12f4b52684a973bbfc508c5906e640572e22a96b9420a7aea86ad8d4aa4d6fcc2bb091f747e2fdd18c897e0456baff254bd5e3ceaf721bd3f09a2fd60b

delete maxblocksinflight.py

Signed-off-by: Pasta <[email protected]>
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants