-
Notifications
You must be signed in to change notification settings - Fork 37.8k
Track block download times per individual block #7804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Concept ACK |
Updated to add a simple self consistency check. |
queuedBlock.nTimeDisconnect = nTimeoutIfRequestedNow; | ||
} | ||
if (queuedBlock.nTimeDisconnect < nNow) { | ||
if (nNow > state.nDownloadingSince + 500000 * consensusParams.nPowTargetSpacing * (4 + nPeersWithValidatedDownloads)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
state.nDownloadingSince + 500000 * consensusParams.nPowTargetSpacing * (4 + nPeersWithValidatedDownloads)
Could we name this constant variable? As what it represents isn't exactly clear IMHO.
Comment, variable, constant, whatever.
Rebased, and introduced constants for the timeouts. |
utACK b18c125 |
Seems like an obvious improvement. Concept ACK. |
@@ -106,6 +106,10 @@ static const unsigned int AVG_INVENTORY_BROADCAST_INTERVAL = 5; | |||
static const unsigned int AVG_FEEFILTER_BROADCAST_INTERVAL = 10 * 60; | |||
/** Maximum feefilter broadcast delay after significant change. */ | |||
static const unsigned int MAX_FEEFILTER_CHANGE_DELAY = 5 * 60; | |||
/** Block download timeout base, expressed in millionths of the block interval */ | |||
static const int64_t BLOCK_DOWNLOAD_TIMEOUT_BASE = 2000000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I understand this correctly that BLOCK_DOWNLOAD_TIMEOUT_BASE
is thus 2000000*(10min/1000000), ie. 20minutes? In either case, it is worth more expressive comment IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the actual clock times to the comment.
Currently, we're keeping a timeout for each requested block, starting from when it is requested, with a correction factor for the number of blocks in the queue. That's unnecessarily complicated and inaccurate. As peers process block requests in order, we can make the timeout for each block start counting only when all previous ones have been received, and have a correction based on the number of peers, rather than the total number of blocks.
0e24bbf Self check after the last peer is removed (Pieter Wuille) 2d1d658 Track block download times per individual block (Pieter Wuille)
utACK 0e24bbf |
Currently, we're keeping a timeout for each requested block, starting from when it is requested, with a correction factor for the number of blocks in the queue. That's unnecessarily complicated and inaccurate. As peers process block requests in order, we can make the timeout for each block start counting only when all previous ones have been received, and have a correction based on the number of peers, rather than the total number of blocks. Conflicts: src/main.cpp src/main.h Self check after the last peer is removed Github-Pull: #7804 Rebased-From: 2d1d658 0e24bbf
Now that bitcoin#7804 fixed the timeout handling, reduce the block timeout from 20 minutes to 10 minutes. 20 minutes is overkill.
post-merge utACK |
Now that bitcoin#7804 fixed the timeout handling, reduce the block timeout from 20 minutes to 10 minutes. 20 minutes is overkill.
Currently, we're keeping a timeout for each requested block, starting from when it is requested, with a correction factor for the number of blocks in the queue. That's unnecessarily complicated and inaccurate. As peers process block requests in order, we can make the timeout for each block start counting only when all previous ones have been received, and have a correction based on the number of peers, rather than the total number of blocks. Conflicts: src/main.cpp src/main.h Self check after the last peer is removed Github-Pull: bitcoin#7804 Rebased-From: 2d1d658 0e24bbf
Now that bitcoin#7804 fixed the timeout handling, reduce the block timeout from 20 minutes to 10 minutes. 20 minutes is overkill. Conflicts: src/main.h Github-Pull: bitcoin#7832 Rebased-From: 62b9a55
@@ -212,6 +207,9 @@ namespace { | |||
|
|||
/** Dirty block file entries. */ | |||
set<int> setDirtyFileInfo; | |||
|
|||
/** Number of peers from which we're downloading blocks. */ | |||
int nPeersWithValidatedDownloads = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not simply nPeersProvidingBlocks? The use of the word 'validated' seems to imply it does more than the comment states.
} | ||
if (state->vBlocksInFlight.begin() == itInFlight->second.second) { | ||
// First block on the queue was received, update the start download time for the next one | ||
state->nDownloadingSince = std::max(state->nDownloadingSince, GetTimeMicros()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When and why would it need to be a date in the future?
@@ -106,6 +106,10 @@ static const unsigned int AVG_INVENTORY_BROADCAST_INTERVAL = 5; | |||
static const unsigned int AVG_FEEFILTER_BROADCAST_INTERVAL = 10 * 60; | |||
/** Maximum feefilter broadcast delay after significant change. */ | |||
static const unsigned int MAX_FEEFILTER_CHANGE_DELAY = 5 * 60; | |||
/** Block download timeout base, expressed in millionths of the block interval (i.e. 20 min) */ | |||
static const int64_t BLOCK_DOWNLOAD_TIMEOUT_BASE = 2000000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 20 minutes?
Currently, we're keeping a timeout for each requested block, starting from when it is requested, with a correction factor for the number of blocks in the queue.
That's unnecessarily complicated and inaccurate.
As peers process block requests in order, we can make the timeout for each block start counting only when all previous ones have been received, and have a correction based on the number of peers, rather than the total number of blocks.