diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2015-08-15 23:32:38 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2015-09-22 18:51:08 +0200 |
commit | 3b33ec85ed00ba7e7525858e3701f9f55071c58b (patch) | |
tree | ff0ec0f97d3058f8bd89edc82b78cf1706308b5a /src/main.cpp | |
parent | 391dff16fe9ace90fc0f3308a5c63c453370e713 (diff) |
Avoid duplicate CheckBlock checks
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 1e0194e2cd..e8bc68fe64 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2587,6 +2587,9 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo { // These are checks that are independent of context. + if (block.fChecked) + return true; + // Check that the header is valid (particularly PoW). This is mostly // redundant with the call in AcceptBlockHeader. if (!CheckBlockHeader(block, state, fCheckPOW)) @@ -2642,6 +2645,9 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo return state.DoS(100, error("CheckBlock(): out-of-bounds SigOpCount"), REJECT_INVALID, "bad-blk-sigops", true); + if (fCheckPOW && fCheckMerkleRoot) + block.fChecked = true; + return true; } |