Skip to content

Conversation

TheBlueMatt
Copy link
Contributor

This is a (somewhat) simpler version of #9447 based on #10652.

It allows for up to 2 simultaneous downloads of the same block at once, as long as the second one is using compact blocks and only has up to 10 transactions to request in a getblocktxn (if applicable).

@TheBlueMatt TheBlueMatt force-pushed the 2017-08-paralell-block-downloads branch 2 times, most recently from 6a66609 to cad4b16 Compare August 14, 2017 16:10
@TheBlueMatt
Copy link
Contributor Author

Rebased and added a simple test

@TheBlueMatt
Copy link
Contributor Author

Rebased.

@TheBlueMatt TheBlueMatt force-pushed the 2017-08-paralell-block-downloads branch from cad4b16 to 458feb3 Compare September 27, 2017 21:06
@jonasschnelli
Copy link
Contributor

Nice work!
Obviously concept ACK (have not looked closely at the code yet).

@TheBlueMatt TheBlueMatt force-pushed the 2017-08-paralell-block-downloads branch from 458feb3 to ea17977 Compare November 29, 2017 17:19
@TheBlueMatt
Copy link
Contributor Author

Rebased.

range.first++;
if (itInFlight->second.first == nodeid) {
if (clearState) ClearDownloadState(itInFlight);
mmapBlocksInFlight.erase(itInFlight);
Copy link
Contributor

Choose a reason for hiding this comment

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

Loose itInFlight:

while (range.first != range.second) {
    if (range.first->second.first == nodeid) {
        if (clearState) ClearDownloadState(range.first);
        range.first = mmapBlocksInFlight.erase(range.first);
    } else {
        range.first++;
    }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Heh, thats more lines (and IMO less readable)...

LOCK(cs_main);
bool found = false;
std::pair<BlockDownloadMap::iterator, BlockDownloadMap::iterator> range = mmapBlocksInFlight.equal_range(hash);
while (range.first != range.second) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Loose found:

if (range.first == range.second) return false;
while (range.first != range.second) {
    ...
}
return true;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

*pit = &itInFlight->second.second;
std::pair<BlockDownloadMap::iterator, BlockDownloadMap::iterator> range = mmapBlocksInFlight.equal_range(hash);
while (range.first != range.second) {
BlockDownloadMap::iterator itInFlight = range.first;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

TheBlueMatt and others added 6 commits January 11, 2018 13:52
This pushes some "is this callback useful" logic down into
net_processing, which is useful for later changes as it allows for
more notifications to be used.
The received block could be malleated, so this is both simpler, and
supports parallel downloads.
…ight

This is a change in behavior so that if for some reason we request a block from a peer, we don't allow an unsolicited CMPCT_BLOCK announcement for that same block to cause a request for a full block from the uninvited peer (as some type of request is already outstanding from the original peer)
...as long as the second one uses compact blocks with no more than
10 missing transactions
@iemwill
Copy link

iemwill commented Feb 24, 2021

@TheBlueMatt

This is a (somewhat) simpler version of #9447 based on #10652.

It allows for up to 2 simultaneous downloads of the same block at once, as long as the second one is using compact blocks and only has up to 10 transactions to request in a getblocktxn (if applicable).

The sentence above is controversial to itself.!

EDIT: (not applicable)!

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants