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
Do not download transactions during initial blockchain sync #7164
Conversation
@@ -5653,7 +5653,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle) | |||
// | |||
// Message: getdata (non-blocks) | |||
// | |||
while (!pto->fDisconnect && !pto->mapAskFor.empty() && (*pto->mapAskFor.begin()).first <= nNow) | |||
while (!pto->fDisconnect && !pto->mapAskFor.empty() && (*pto->mapAskFor.begin()).first <= nNow && !IsInitialBlockDownload()) |
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.
No need to check IsInitialBlockDownload() every iteration of the while loop.
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.
made the change and pushed.
On 03/12/2015 6:19 AM, Wladimir J. van der Laan wrote:
In src/main.cpp
#7164 (comment):@@ -5653,7 +5653,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
//
// Message: getdata (non-blocks)
//
while (!pto->fDisconnect && !pto->mapAskFor.empty() && (*pto->mapAskFor.begin()).first <= nNow)
while (!pto->fDisconnect && !pto->mapAskFor.empty() && (*pto->mapAskFor.begin()).first <= nNow && !IsInitialBlockDownload())
No need to check IsInitialBlockDownload() every iteration of the while
loop.—
Reply to this email directly or view it on GitHub
https://github.com/bitcoin/bitcoin/pull/7164/files#r46555484.
Despite not liking how more and more depends on IsInitialBlockDownload(), I think this makes sense. Downloading transactions during initial sync just gets a long list of "Rejected: Non-final" and wastes bandwidth and verification overhead. |
utACK |
Concept ACK |
conceptACK/utACK |
acutally please don't merge this yet, there is a problem with the On 03/12/2015 12:14 PM, Daniel Cousens wrote:
|
Travis is happy now...during running the regression tests, the block in util.py:
On 03/12/2015 12:14 PM, Daniel Cousens wrote:
|
# at 1 Jan 2014 | ||
block_time = 1388534400 | ||
# blocks are created with timestamps 10 minutes apart | ||
# going backwards in time from now |
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.
Nit: ", starting 2000 minutes in the past"?
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.
sure, that sounds better
(and it's 2000 minutes in the past).
I'll push it up with the changes for updating the cache every 24hours.
On 03/12/2015 3:34 PM, MarcoFalke wrote:
In qa/rpc-tests/test_framework/util.py
#7164 (comment):@@ -154,9 +154,9 @@ def initialize_chain(test_dir):
# Create a 200-block-long chain; each of the 4 nodes # gets 25 mature blocks and 25 immature.
# blocks are created with timestamps 10 minutes apart, starting
# at 1 Jan 2014
block_time = 1388534400
# blocks are created with timestamps 10 minutes apart
# going backwards in time from now
Nit: ", starting 200 minutes in the past"?
—
Reply to this email directly or view it on GitHub
https://github.com/bitcoin/bitcoin/pull/7164/files#r46629519.
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.
Ok that should do it,
pushed and travis is good
have a look when you can.
On 03/12/2015 3:34 PM, MarcoFalke wrote:
In qa/rpc-tests/test_framework/util.py
#7164 (comment):@@ -154,9 +154,9 @@ def initialize_chain(test_dir):
# Create a 200-block-long chain; each of the 4 nodes # gets 25 mature blocks and 25 immature.
# blocks are created with timestamps 10 minutes apart, starting
# at 1 Jan 2014
block_time = 1388534400
# blocks are created with timestamps 10 minutes apart
# going backwards in time from now
Nit: ", starting 200 minutes in the past"?
—
Reply to this email directly or view it on GitHub
https://github.com/bitcoin/bitcoin/pull/7164/files#r46629519.
3fb49df
to
725835b
Compare
@MarcoFalke Fixed that nit. Also added refreshing the cache every twelve hours which will prevent any very very long running regression tests from going over the 24hr limit for the age of the cache and subsequently preventing the mempools from syncing. |
Ugh that "maximum 24 hours" check has tripped us up multiple times. Another option to avoid the cache invalid issue would be to change https://github.com/bitcoin/bitcoin/blob/master/src/chainparams.cpp#L172 I'd prefer that myself to having to expire the cache every 12 hours just to avoid this check. Although there's something to be said for testing Yet another option would be to set a mock time, but this isn't easy to do consistently. |
2acebaa
to
030c552
Compare
@laanwj Changing nmaxtipage certainly is an easy fix but I never like the idea of changing the behaviour of an app before regression testing, it sometimes bites down the road. I used mocktime instead but then had issues with nodehandling because GetTime() doesn't increment properly once you set mocktime. Made some edits there to make GetTime() increment correctly if mocktime is set. Also needed a small edit to p2pfullblocktest to set the time base to MOCKTIME. Pushed and travis is happy... |
re-utACK |
Oops there is one last thing, there are a few of extended tests that might need the mocktime. I can't execute them because of ndbm which doesn't run on windows so I'll have to try things out on Travis. I think about 4 scripts that might need fixing up. Shouldn't take too long...I'll let you know when it's done. |
Rebase needed. |
I like the overall goal here, but I'm not sure I follow the reasoning for changing the behavior of Can we work around this problem differently in the tests? I don't actually understand why the time would need to advance but I haven't yet poked into the problems you ran into. But for instance, one workaround I've used in tests I've previously written is to just mine a single block at the beginning of the test to ensure that the nodes are out of IBD (I recognize this workaround may not easily apply to all testing scenarios though). |
Mocktime needs to advance otherwise banning and unbanning doesn't work On 05/12/2015 6:40 AM, Suhas Daftuar wrote:
|
ea8e6d6
to
b51b7bf
Compare
@sdaftuar Thinking about this some more perhaps you are right, but maybe we can have both. We can have the mocktime we have now and also have a mocktime that will advance for those that need it. It would certainly be easier than having to fix up these python scripts. |
Github-Pull: bitcoin#7164 Rebased-From: 39a525c
Backported as part of #7938. Removing label 'Needs backport'. |
Github-Pull: bitcoin#7164 Rebased-From: 39a525c
After discussion in bitcoin#7164 I think this is better. Max tip age was introduced in bitcoin#5987 to make it possible to run testnet-in-a-box. But associating this behavior with the testnet chain is wrong conceptually, as it is not needed in normal usage. Should aim to make testnet test the software as-is. Replace it with a (debug) option `-maxtipage`, which can be specified only in the specific case.
Skip "tx" messages during initial block download. We avoid requesting these messages by not request non-block inventory during IBD. This is equivalent to bitcoin/bitcoin#7164, but we also ignore unsolicited `tx` messages (which `zcashd` nodes will never send). Fixes #4943.
What I've noticed now that transaction rates are getting much higher is that every time a block is downloaded during the initial sync, sometimes 5, 10 or more new transactions are being downloaded as well and is slowing down the initial sync process. There is no reason to do a "getdata" and download these transactions since they are not getting accepted into the mempool anyway.