aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorRoss Nicoll <[email protected]>2015-08-10 20:07:34 +0100
committerRoss Nicoll <[email protected]>2015-08-10 20:07:34 +0100
commit61e0e2ba4528cfd2820c488093a0755718f74e38 (patch)
tree188882631031790f2c1b2dc6497cdfd1850caf08 /src/main.cpp
parentMerge pull request #1224 from rnicoll/1.10-paperwallet (diff)
parentEnable block constraints properly (diff)
downloaddiscoin-61e0e2ba4528cfd2820c488093a0755718f74e38.tar.xz
discoin-61e0e2ba4528cfd2820c488093a0755718f74e38.zip
Merge pull request #1234 from patricklodder/1.10-constraint-flags
Enable block constraints for BIP16 and 30 properly
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/main.cpp b/src/main.cpp
index a3d5dcc30..0f4fdf26f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1837,23 +1837,21 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
// Now that the whole chain is irreversibly beyond that time it is applied to all blocks except the
// two in the chain that violate it. This prevents exploiting the issue against nodes during their
// initial block download.
- bool fEnforceBIP30 = (!pindex->phashBlock) || // Enforce on CreateNewBlock invocations which don't have a hash.
- !((pindex->nHeight==91842 && pindex->GetBlockHash() == uint256S("0x00000000000a4d0a398161ffc163c503763b1f4360639393e0e4c8e300e0caec")) ||
- (pindex->nHeight==91880 && pindex->GetBlockHash() == uint256S("0x00000000000743f190a18c5577a3c2d2a1f610ae9601ac046a38084ccb7cd721")));
- if (fEnforceBIP30) {
+ //bool fEnforceBIP30 = (!pindex->phashBlock) || // Enforce on CreateNewBlock invocations which don't have a hash.
+ // !((pindex->nHeight==91842 && pindex->GetBlockHash() == uint256S("0x00000000000a4d0a398161ffc163c503763b1f4360639393e0e4c8e300e0caec")) ||
+ // (pindex->nHeight==91880 && pindex->GetBlockHash() == uint256S("0x00000000000743f190a18c5577a3c2d2a1f610ae9601ac046a38084ccb7cd721")));
+ //if (fEnforceBIP30) {
+ // Dogecoin: BIP30 has been active since inception
BOOST_FOREACH(const CTransaction& tx, block.vtx) {
const CCoins* coins = view.AccessCoins(tx.GetHash());
if (coins && !coins->IsPruned())
return state.DoS(100, error("ConnectBlock(): tried to overwrite transaction"),
REJECT_INVALID, "bad-txns-BIP30");
}
- }
-
- // BIP16 didn't become active until Apr 1 2012
- int64_t nBIP16SwitchTime = 1333238400;
- bool fStrictPayToScriptHash = (pindex->GetBlockTime() >= nBIP16SwitchTime);
+ //}
- unsigned int flags = fStrictPayToScriptHash ? SCRIPT_VERIFY_P2SH : SCRIPT_VERIFY_NONE;
+ // Dogecoin: BIP16 has been active since inception
+ unsigned int flags = SCRIPT_VERIFY_P2SH;
// Start enforcing the DERSIG (BIP66) rules, for block.nVersion=3 blocks, when 75% of the network has upgraded:
if (block.nVersion >= 3 && IsSuperMajority(3, pindex->pprev, consensus.nMajorityEnforceBlockUpgrade, consensus)) {
@@ -1888,16 +1886,15 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
return state.DoS(100, error("ConnectBlock(): inputs missing/spent"),
REJECT_INVALID, "bad-txns-inputs-missingorspent");
- if (fStrictPayToScriptHash)
- {
- // Add in sigops done by pay-to-script-hash inputs;
- // this is to prevent a "rogue miner" from creating
- // an incredibly-expensive-to-validate block.
- nSigOps += GetP2SHSigOpCount(tx, view);
- if (nSigOps > MAX_BLOCK_SIGOPS)
- return state.DoS(100, error("ConnectBlock(): too many sigops"),
- REJECT_INVALID, "bad-blk-sigops");
- }
+
+ // Add in sigops done by pay-to-script-hash inputs;
+ // this is to prevent a "rogue miner" from creating
+ // an incredibly-expensive-to-validate block.
+ // Dogecoin: BIP16 has been enabled since inception
+ nSigOps += GetP2SHSigOpCount(tx, view);
+ if (nSigOps > MAX_BLOCK_SIGOPS)
+ return state.DoS(100, error("ConnectBlock(): too many sigops"),
+ REJECT_INVALID, "bad-blk-sigops");
nFees += view.GetValueIn(tx)-tx.GetValueOut();