mirror of
https://github.com/dogecoin/dogecoin.git
synced 2026-03-05 02:26:01 +00:00
Correct BIP 66 patches
This commit is contained in:
parent
53a49c0246
commit
c71c351176
41
src/main.cpp
41
src/main.cpp
@ -2761,29 +2761,30 @@ bool AcceptBlock(CBlock& block, CValidationState& state, CBlockIndex** ppindex,
|
||||
REJECT_INVALID, "bad-txns-nonfinal");
|
||||
}
|
||||
|
||||
// Reject block.nVersion=2 blocks when 95% (75% on testnet) of the network has upgraded:
|
||||
if (block.nVersion < 3)
|
||||
// Reject block.nVersion=2 blocks when 95% (75% on testnet) of the network has upgraded:
|
||||
if (block.nVersion < 3)
|
||||
{
|
||||
if ((!TestNet() && CBlockIndex::IsSuperMajority(3, pindex->pprev, 950, 1000)) ||
|
||||
(TestNet() && CBlockIndex::IsSuperMajority(3, pindex->pprev, 75, 100)))
|
||||
{
|
||||
if ((!TestNet() && CBlockIndex::IsSuperMajority(3, pindexPrev, 950, 1000)) ||
|
||||
(TestNet() && CBlockIndex::IsSuperMajority(3, pindexPrev, 75, 100)))
|
||||
{
|
||||
return state.Invalid(error("AcceptBlock() : rejected nVersion=2 block"),
|
||||
REJECT_OBSOLETE, "bad-version");
|
||||
}
|
||||
return state.Invalid(error("AcceptBlock() : rejected nVersion=2 block"),
|
||||
REJECT_OBSOLETE, "bad-version");
|
||||
}
|
||||
// Enforce block.nVersion=2 rule that the coinbase starts with serialized block height
|
||||
if (block.nVersion >= 2)
|
||||
}
|
||||
// Enforce block.nVersion=2 rule that the coinbase starts with serialized block height
|
||||
if (block.nVersion >= 2)
|
||||
{
|
||||
// if 750 of the last 1,000 blocks are version 2 or greater (51/100 if testnet):
|
||||
if ((!TestNet() && CBlockIndex::IsSuperMajority(2, pindex->pprev, 750, 1000)) ||
|
||||
(TestNet() && CBlockIndex::IsSuperMajority(2, pindex->pprev, 51, 100)))
|
||||
{
|
||||
// if 750 of the last 1,000 blocks are version 2 or greater (51/100 if testnet):
|
||||
if ((!TestNet() && CBlockIndex::IsSuperMajority(2, pindex->pprev, 750, 1000)) ||
|
||||
(TestNet() && CBlockIndex::IsSuperMajority(2, pindex->pprev, 51, 100)))
|
||||
CScript expect = CScript() << nHeight;
|
||||
if (block.vtx[0].vin[0].scriptSig.size() < expect.size() ||
|
||||
!std::equal(expect.begin(), expect.end(), block.vtx[0].vin[0].scriptSig.begin())) {
|
||||
pindex->nStatus |= BLOCK_FAILED_VALID;
|
||||
return state.DoS(100, error("AcceptBlock() : block height mismatch in coinbase"),
|
||||
REJECT_INVALID, "bad-cb-height");
|
||||
}
|
||||
CScript expect = CScript() << nHeight;
|
||||
if (block.vtx[0].vin[0].scriptSig.size() < expect.size() ||
|
||||
!std::equal(expect.begin(), expect.end(), block.vtx[0].vin[0].scriptSig.begin())) {
|
||||
pindex->nStatus |= BLOCK_FAILED_VALID;
|
||||
return state.DoS(100, error("AcceptBlock() : block height mismatch in coinbase"),
|
||||
REJECT_INVALID, "bad-cb-height");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -191,6 +191,7 @@ enum
|
||||
SCRIPT_VERIFY_LOW_S = (1U << 2), // enforce low S values (<n/2) in signatures (depends on STRICTENC)
|
||||
SCRIPT_VERIFY_NOCACHE = (1U << 3), // do not store results in signature cache (but do query it)
|
||||
SCRIPT_VERIFY_DERSIG = (1U << 4), // enforce signature encodings as defined by BIP 66 (which is a softfork, while STRICTENC is not)
|
||||
SCRIPT_VERIFY_NULLDUMMY = (1U << 5), // verify dummy stack item consumed by CHECKMULTISIG is of zero-length
|
||||
};
|
||||
|
||||
// Mandatory script verification flags that all new blocks must comply with for
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user