diff --git a/src/bloom.cpp b/src/bloom.cpp index 24eebe2e3..d3504f98e 100644 --- a/src/bloom.cpp +++ b/src/bloom.cpp @@ -3,6 +3,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include +#include #include #include @@ -166,7 +167,8 @@ bool CBloomFilter::IsRelevantAndUpdate(const CTransaction& tx) { txnouttype type; std::vector > vSolutions; - if (Solver(txout.scriptPubKey, type, vSolutions) && + const CScript& scriptPubKey = StripClaimScriptPrefix(txout.scriptPubKey); + if (Solver(scriptPubKey, type, vSolutions) && (type == TX_PUBKEY || type == TX_MULTISIG)) insert(COutPoint(hash, i)); } diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 1442e783d..dd9b33ab5 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -145,6 +145,7 @@ public: consensus.nNormalizedNameForkHeight = 539940; // targeting 21 March 2019 consensus.nMinTakeoverWorkaroundHeight = 496850; consensus.nMaxTakeoverWorkaroundHeight = 10000000; + consensus.nWitnessForkHeight = 700000; consensus.fPowAllowMinDifficultyBlocks = false; consensus.fPowNoRetargeting = false; consensus.nRuleChangeActivationThreshold = 1916; // 95% of a half week @@ -158,7 +159,7 @@ public: consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1462060800; // May 1st, 2016 consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 1493596800; // May 1st, 2017 - // Deployment of SegWit (BIP141, BIP143, and BIP147) + // Deployment of SegWit (BIP141, BIP143, and BIP147) -- Unused (see nWitnessForkHeight). consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1; consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = 1547942400; // Jan 20, 2019 consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1548288000; // Jan 24, 2019 @@ -262,6 +263,7 @@ public: consensus.nNormalizedNameForkHeight = 993380; // targeting, 21 Feb 2019 consensus.nMinTakeoverWorkaroundHeight = 99; consensus.nMaxTakeoverWorkaroundHeight = 10000000; + consensus.nWitnessForkHeight = 1600000; consensus.fPowAllowMinDifficultyBlocks = true; consensus.fPowNoRetargeting = false; consensus.nRuleChangeActivationThreshold = 1512; // 75% for testchains @@ -275,7 +277,7 @@ public: consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1456790400; // March 1st, 2016 consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 1493596800; // May 1st, 2017 - // Deployment of SegWit (BIP141, BIP143, and BIP147) + // Deployment of SegWit (BIP141, BIP143, and BIP147) -- Unused (see nWitnessForkHeight). consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1; consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = 1462060800; // May 1st 2016 consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1493596800; // May 1st 2017 @@ -367,6 +369,7 @@ public: consensus.nNormalizedNameForkHeight = 250; // SDK depends upon this number consensus.nMinTakeoverWorkaroundHeight = -1; consensus.nMaxTakeoverWorkaroundHeight = -1; + consensus.nWitnessForkHeight = 150; consensus.fPowAllowMinDifficultyBlocks = false; consensus.fPowNoRetargeting = false; consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains diff --git a/src/claimscriptop.h b/src/claimscriptop.h index 7fc93048a..afea2930c 100644 --- a/src/claimscriptop.h +++ b/src/claimscriptop.h @@ -59,17 +59,17 @@ public: */ CClaimScriptAddOp(const COutPoint& point, CAmount nValue, int nHeight); /** - * Implamention of OP_CLAIM_NAME handler + * Implementation of OP_CLAIM_NAME handler * @see CClaimScriptOp::claimName */ bool claimName(CClaimTrieCache& trieCache, const std::string& name) override; /** - * Implamention of OP_UPDATE_CLAIM handler + * Implementation of OP_UPDATE_CLAIM handler * @see CClaimScriptOp::updateClaim */ bool updateClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId) override; /** - * Implamention of OP_SUPPORT_CLAIM handler + * Implementation of OP_SUPPORT_CLAIM handler * @see CClaimScriptOp::supportClaim */ bool supportClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId) override; @@ -100,17 +100,17 @@ public: */ CClaimScriptUndoAddOp(const COutPoint& point, int nHeight); /** - * Implamention of OP_CLAIM_NAME handler + * Implementation of OP_CLAIM_NAME handler * @see CClaimScriptOp::claimName */ bool claimName(CClaimTrieCache& trieCache, const std::string& name) override; /** - * Implamention of OP_UPDATE_CLAIM handler + * Implementation of OP_UPDATE_CLAIM handler * @see CClaimScriptOp::updateClaim */ bool updateClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId) override; /** - * Implamention of OP_SUPPORT_CLAIM handler + * Implementation of OP_SUPPORT_CLAIM handler * @see CClaimScriptOp::supportClaim */ bool supportClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId) override; @@ -141,17 +141,17 @@ public: */ CClaimScriptSpendOp(const COutPoint& point, int nHeight, int& nValidHeight); /** - * Implamention of OP_CLAIM_NAME handler + * Implementation of OP_CLAIM_NAME handler * @see CClaimScriptOp::claimName */ bool claimName(CClaimTrieCache& trieCache, const std::string& name) override; /** - * Implamention of OP_UPDATE_CLAIM handler + * Implementation of OP_UPDATE_CLAIM handler * @see CClaimScriptOp::updateClaim */ bool updateClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId) override; /** - * Implamention of OP_SUPPORT_CLAIM handler + * Implementation of OP_SUPPORT_CLAIM handler * @see CClaimScriptOp::supportClaim */ bool supportClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId) override; @@ -184,17 +184,17 @@ public: */ CClaimScriptUndoSpendOp(const COutPoint& point, CAmount nValue, int nHeight, int nValidHeight); /** - * Implamention of OP_CLAIM_NAME handler + * Implementation of OP_CLAIM_NAME handler * @see CClaimScriptOp::claimName */ bool claimName(CClaimTrieCache& trieCache, const std::string& name) override; /** - * Implamention of OP_UPDATE_CLAIM handler + * Implementation of OP_UPDATE_CLAIM handler * @see CClaimScriptOp::updateClaim */ bool updateClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId) override; /** - * Implamention of OP_SUPPORT_CLAIM handler + * Implementation of OP_SUPPORT_CLAIM handler * @see CClaimScriptOp::supportClaim */ bool supportClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId) override; diff --git a/src/consensus/params.h b/src/consensus/params.h index 0bb2affc6..582159a27 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -81,6 +81,8 @@ struct Params { int nMinTakeoverWorkaroundHeight; int nMaxTakeoverWorkaroundHeight; + int nWitnessForkHeight; + int64_t nPowTargetSpacing; int64_t nPowTargetTimespan; /** how long it took claims to expire before the hard fork */ diff --git a/src/consensus/tx_verify.cpp b/src/consensus/tx_verify.cpp index d80da5d1b..47c9d0248 100644 --- a/src/consensus/tx_verify.cpp +++ b/src/consensus/tx_verify.cpp @@ -154,7 +154,8 @@ int64_t GetTransactionSigOpCost(const CTransaction& tx, const CCoinsViewCache& i const Coin& coin = inputs.AccessCoin(tx.vin[i].prevout); assert(!coin.IsSpent()); const CTxOut &prevout = coin.out; - nSigOps += CountWitnessSigOps(tx.vin[i].scriptSig, prevout.scriptPubKey, &tx.vin[i].scriptWitness, flags); + const CScript& scriptPubKey = StripClaimScriptPrefix(prevout.scriptPubKey); + nSigOps += CountWitnessSigOps(tx.vin[i].scriptSig, scriptPubKey, &tx.vin[i].scriptWitness, flags); } return nSigOps; } diff --git a/src/core_write.cpp b/src/core_write.cpp index 34a9d2360..df6897b0e 100644 --- a/src/core_write.cpp +++ b/src/core_write.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include