2WP: Separate mainchain and sidechain data structures into different classes, with the bitcoin data structures living in the src/primitives/bitcoin subdirectory.

This commit is contained in:
Mark Friedenbach 2017-02-28 16:36:56 -08:00 committed by Gregory Sanders
parent 2a0eda566a
commit f39435a877
17 changed files with 1297 additions and 143 deletions

View file

@ -12,6 +12,7 @@
#include "hash.h"
#include "keystore.h"
#include "primitives/block.h"
#include "primitives/bitcoin/block.h"
#include "script/generic.hpp"
#include "script/standard.h"
#include "uint256.h"
@ -37,15 +38,13 @@ void ResetChallenge(CBlockHeader& block, const CBlockIndex& indexLast, const Con
block.proof.challenge = indexLast.proof.challenge;
}
bool CheckBitcoinProof(const CBlockHeader& block)
bool CheckBitcoinProof(const Sidechain::Bitcoin::CBlockHeader& block)
{
assert(block.IsBitcoinBlock());
bool fNegative;
bool fOverflow;
arith_uint256 bnTarget;
bnTarget.SetCompact(block.bitcoinproof.challenge, &fNegative, &fOverflow);
bnTarget.SetCompact(block.nBits, &fNegative, &fOverflow);
// Check range
if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(Params().GetConsensus().parentChainPowLimit))