Bugfix: Don’t check the genesis block header before accepting it #6299
pull jtimon wants to merge 2 commits into bitcoin:master from jtimon:5975-quick-fix changing 2 files +22 −21-
jtimon commented at 7:30 pm on June 17, 2015: contributorThis should fix an error that was introduced in #5975 , thanks @sdaftuar for reporting the error. I will work on a more elegant solution: the genesis block should never be checked at all; it is valid by definition. But it seems that will be more work than I first thought so let’s just fix the bug first.
-
in src/main.cpp: in 460c57e049 outdated
2808@@ -2809,6 +2809,7 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc 2809 uint256 hash = block.GetHash(); 2810 BlockMap::iterator miSelf = mapBlockIndex.find(hash); 2811 CBlockIndex *pindex = NULL; 2812+ if (hash != chainparams.GetConsensus().hashGenesisBlock) { 2813 if (miSelf != mapBlockIndex.end()) {
laanwj commented at 7:34 pm on June 17, 2015:Indentation missing
petertodd commented at 3:17 am on June 18, 2015:I’d prefer those merge conflicts to stay merge conflicts, as it forces you to understand if that additional check matters for your merge.
What can I say, I once fixed a bug where a lack of indentation of a newly added bit of code lead to a mistake that could have potentially played a part of getting someone killed, so… :/
jtimon commented at 7:29 am on June 18, 2015:I’m happy to indent if people think it’s better.
laanwj commented at 9:23 am on June 18, 2015:Yes, that is still the plan at some point, although I’d say it’s very low priority.
Reducing the diff is generally a good reason, but not enough to deviate this much from the coding style IMO. This makes the control flow harder to interpret in an important function.
laanwj added the label Bug on Jun 17, 2015jtimon force-pushed on Jun 18, 2015jtimon commented at 9:36 am on June 18, 2015: contributorUpdated with the correct indentation (bigger diff).laanwj commented at 12:36 pm on June 18, 2015: memberutACKtheuni commented at 5:27 pm on June 19, 2015: memberBtw, for the sake of easier review, you can always do a diff that ignores whitespace via
git diff -w
.To see that at github, just append ?w=1 to the url: https://github.com/bitcoin/bitcoin/pull/6299/files?w=1
Bugfix: Don't check the genesis block header before accepting it
This fixes an error triggered when running with -reindex after #5975
test: Move reindex test to standard tests
This test finishes very quickly, so it should be part of the default set of tests in rpc-tests.
jtimon force-pushed on Jun 20, 2015sdaftuar commented at 5:12 pm on June 24, 2015: memberTested ACKjtimon referenced this in commit f629538693 on Jun 26, 2015laanwj merged this on Jun 26, 2015laanwj closed this on Jun 26, 2015
laanwj referenced this in commit 24f24896d6 on Jun 26, 2015laanwj commented at 1:41 pm on June 26, 2015: memberACKjtimon referenced this in commit d84dc4771b on Jun 26, 2015jtimon referenced this in commit 60dbe9a6d6 on Jul 1, 2015jtimon referenced this in commit ccbf23b72d on Jul 1, 2015zkbot referenced this in commit 9af55822fb on Feb 15, 2017zkbot referenced this in commit df07f9ad23 on Feb 15, 2017zkbot referenced this in commit a7cf698873 on Mar 4, 2017MarcoFalke locked this on Sep 8, 2021
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-18 18:12 UTC
More mirrored repositories can be found on mirror.b10c.me