Set nSequenceId when a block is fully linked #6010
pull sdaftuar wants to merge 1 commits into bitcoin:master from sdaftuar:fix-equal-work-chain-selection changing 1 files +5 −4-
sdaftuar commented at 0:26 am on April 14, 2015: memberThis fixes the assignment of nSequenceId for headers-first, which can result in blocks being downloaded out of order.
-
laanwj added the label Consensus on Apr 14, 2015
-
sipa commented at 9:14 am on April 14, 2015: memberutACK
-
laanwj added this to the milestone 0.10.0 on Apr 14, 2015
-
Set nSequenceId when a block is fully linked
Also adds a test to CheckBlockIndex
-
sdaftuar force-pushed on Apr 14, 2015
-
sdaftuar commented at 5:30 pm on April 14, 2015: memberAdded a CheckBlockIndex test and squashed.
-
in src/main.cpp: in c1ecee8f72
3268@@ -3269,6 +3269,7 @@ void static CheckBlockIndex() 3269 // HAVE_DATA is equivalent to VALID_TRANSACTIONS and equivalent to nTx > 0 (we stored the number of transactions in the block) 3270 assert(!(pindex->nStatus & BLOCK_HAVE_DATA) == (pindex->nTx == 0)); 3271 assert(((pindex->nStatus & BLOCK_VALID_MASK) >= BLOCK_VALID_TRANSACTIONS) == (pindex->nTx > 0)); 3272+ if (pindex->nChainTx == 0) assert(pindex->nSequenceId == 0); // nSequenceId can't be set for blocks that aren't linked
laanwj commented at 8:31 am on April 15, 2015:Won’t the new test fail on older installs, which may have already sequence numbers assigned to blocks that aren’t linked?
sipa commented at 8:39 am on April 15, 2015:nSequence id’s are memory-only; they are not stored on disk.
laanwj commented at 8:42 am on April 15, 2015:OK, good -
laanwj commented at 8:45 am on April 15, 2015: memberutACK
-
laanwj merged this on Apr 20, 2015
-
laanwj closed this on Apr 20, 2015
-
laanwj referenced this in commit 2bc6332df8 on Apr 20, 2015
-
laanwj referenced this in commit bac6fca3c9 on Apr 20, 2015
-
laanwj commented at 11:54 am on April 20, 2015: memberCherry-picked to 0.10 via bac6fca
-
gmaxwell commented at 4:51 pm on April 20, 2015: contributortested (basic operating tests) ACK.
-
reddink referenced this in commit a77aacf0c2 on Jul 11, 2020
-
reddink referenced this in commit f17141932b on Jul 14, 2020
-
DrahtBot locked this on Sep 8, 2021