Bugfix CValidationResult for BIP30 + add DoS #2279
pull sipa wants to merge 1 commits into bitcoin:master from sipa:cvrbip30 changing 1 files +1 −1-
sipa commented at 3:35 PM on February 6, 2013: member
-
Bugfix CValidationResult for BIP30 + add DoS 7cdc37c0a4
-
gavinandresen commented at 4:38 PM on February 6, 2013: contributor
For belt-and-suspenders sanity, I think places where we rely on other methods to set state.Invalid should have asserts; e.g.:
// Check it again in case a previous version let a bad block in if (!CheckBlock(state, !fJustCheck, !fJustCheck)) { assert(!state.IsValid()); // Rely on CheckBlock to set invalid state return false; } -
gavinandresen commented at 6:43 PM on February 6, 2013: contributor
After more code review: ACK for 0.8
But I think some deeper thought would be good for a better approach to handling database corruption/loss.
For example: if CBlock::DisconnectBlock() returns error("DisconnectBlock() : no undo data available"); ... then SetBestChain() will return false-but-with-a-valid-state ... so ConnectBestBlock() will return etc... ... so AddToBlockIndex() ... ... so AcceptBlock() ... ... so ProcessBlock() will return false-but-with-a-valid-state ... which looks like the right thing to do in all the cases where ProcessBlock() is called.
-
luke-jr commented at 6:54 PM on February 6, 2013: member
I suppose an advantage of the return-CValidationResult model would be that we'd get the compiler yelling at us for any missing states...
-
BitcoinPullTester commented at 8:40 PM on February 6, 2013: none
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/7cdc37c0a427a378944cf58798164320110efe39 for binaries and test log.
- gavinandresen referenced this in commit 8f66aedfaa on Feb 6, 2013
- gavinandresen merged this on Feb 6, 2013
- gavinandresen closed this on Feb 6, 2013
- sipa deleted the branch on May 3, 2013
- laudney referenced this in commit 9e6ac13a5d on Mar 19, 2014
- DrahtBot locked this on Sep 8, 2021