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
e30340a8d6
commit
c87debb048
3 changed files with 9 additions and 1 deletions
|
|
@ -61,6 +61,12 @@ public:
|
|||
consensus.BIP65Height = 388381; // 000000000000000004c2b624ed5d7756c508d90fd0da2c7c679febfa6c4735f0
|
||||
consensus.BIP66Height = 363725; // 00000000000000000379eaa19dce8c9b722d46ae6a57c2f1a988119488b50931
|
||||
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;
|
||||
|
|
@ -166,6 +172,7 @@ public:
|
|||
consensus.BIP65Height = 1351; // BIP65 activated on regtest (Used in rpc activation tests)
|
||||
consensus.BIP66Height = 1251; // BIP66 activated on regtest (Used in rpc activation tests)
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ bool CheckBitcoinProof(uint256 hash, unsigned int nBits)
|
|||
bnTarget.SetCompact(nBits, &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