mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
Add parentChainPowLimit, check in CheckBitcoinProof
This commit is contained in:
parent
8c8565c9e5
commit
85be0821fa
3 changed files with 9 additions and 1 deletions
|
|
@ -56,6 +56,12 @@ public:
|
|||
consensus.BIP34Height = 227931;
|
||||
consensus.BIP34Hash = uint256S("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8");
|
||||
consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
// Peg-ins Bitcoin headers must have higher difficulty target than this field
|
||||
// This value must be sufficiently small to not preclude realistic parent
|
||||
// chain difficulty during network lifespan yet sufficiently large to
|
||||
// deny peg-in DoS attacks due to our inability to ban after failed
|
||||
// IsBitcoinBlock RPC checks.
|
||||
consensus.parentChainPowLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
||||
consensus.nPowTargetSpacing = 10 * 60;
|
||||
consensus.fPowAllowMinDifficultyBlocks = false;
|
||||
|
|
@ -153,6 +159,7 @@ public:
|
|||
consensus.BIP34Height = -1; // BIP34 has not necessarily activated on regtest
|
||||
consensus.BIP34Hash = uint256();
|
||||
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
consensus.parentChainPowLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
||||
consensus.nPowTargetSpacing = 10 * 60;
|
||||
consensus.fPowAllowMinDifficultyBlocks = true;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ struct Params {
|
|||
BIP9Deployment vDeployments[MAX_VERSION_BITS_DEPLOYMENTS];
|
||||
/** Proof of work parameters */
|
||||
uint256 powLimit;
|
||||
uint256 parentChainPowLimit;
|
||||
bool fPowAllowMinDifficultyBlocks;
|
||||
bool fPowNoRetargeting;
|
||||
int64_t nPowTargetSpacing;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ bool CheckBitcoinProof(const CBlockHeader& block)
|
|||
bnTarget.SetCompact(block.bitcoinproof.challenge, &fNegative, &fOverflow);
|
||||
|
||||
// Check range
|
||||
if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(Params().GetConsensus().powLimit))
|
||||
if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(Params().GetConsensus().parentChainPowLimit))
|
||||
return false;
|
||||
|
||||
// Check proof of work matches claimed amount
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue