diff options
| author | Daniel Kraft <[email protected]> | 2014-11-11 14:10:40 +0100 |
|---|---|---|
| committer | Daniel Kraft <[email protected]> | 2014-11-21 11:22:28 +0100 |
| commit | 876f23f5f182a202fc6ad641eaae3316895f0c84 (patch) | |
| tree | 0f72548bef2926cf5c032a349d1bb391d22b3f80 /src/auxpow.cpp | |
| parent | Merge pull request #747 from langerhans/1.8.1-dogechain-https (diff) | |
| download | discoin-876f23f5f182a202fc6ad641eaae3316895f0c84.tar.xz discoin-876f23f5f182a202fc6ad641eaae3316895f0c84.zip | |
Remove unreachable code.
The removed case (pcHead == script.end()) can never be reached, since
we explicitly error out above if that is the case. It is legacy from
Namecoin's merge-mining, which does not forbid this case earlier.
Diffstat (limited to 'src/auxpow.cpp')
| -rw-r--r-- | src/auxpow.cpp | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/auxpow.cpp b/src/auxpow.cpp index daebfa7f0..8e0497040 100644 --- a/src/auxpow.cpp +++ b/src/auxpow.cpp @@ -54,24 +54,12 @@ bool CAuxPow::Check(uint256 hashAuxBlock, int nChainID) if (pc == script.end()) return error("Aux POW missing chain merkle root in parent coinbase"); - if (pcHead != script.end()) - { - // Enforce only one chain merkle root by checking that a single instance of the merged - // mining header exists just before. - if (script.end() != std::search(pcHead + 1, script.end(), UBEGIN(pchMergedMiningHeader), UEND(pchMergedMiningHeader))) - return error("Multiple merged mining headers in coinbase"); - if (pcHead + sizeof(pchMergedMiningHeader) != pc) - return error("Merged mining header is not just before chain merkle root"); - } - else - { - // For backward compatibility. - // Enforce only one chain merkle root by checking that it starts early in the coinbase. - // 8-12 bytes are enough to encode extraNonce and nBits. - if (pc - script.begin() > 20) - return error("Aux POW chain merkle root must start in the first 20 bytes of the parent coinbase"); - } - + // Enforce only one chain merkle root by checking that a single instance of the merged + // mining header exists just before. + if (script.end() != std::search(pcHead + 1, script.end(), UBEGIN(pchMergedMiningHeader), UEND(pchMergedMiningHeader))) + return error("Multiple merged mining headers in coinbase"); + if (pcHead + sizeof(pchMergedMiningHeader) != pc) + return error("Merged mining header is not just before chain merkle root"); // Ensure we are at a deterministic point in the merkle leaves by hashing // a nonce and our chain ID and comparing to the index. |