Restore zcash coinbase rule and launch fix at 10080
This commit is contained in:
@@ -92,7 +92,7 @@ public:
|
||||
{
|
||||
strNetworkID = "main";
|
||||
strCurrencyUnits = "KMD";
|
||||
consensus.fCoinbaseMustBeProtected = false;//true;
|
||||
consensus.fCoinbaseMustBeProtected = true; // this is only enforced after block 10080 on Verus
|
||||
consensus.nSubsidySlowStartInterval = 20000;
|
||||
consensus.nSubsidyHalvingInterval = 840000;
|
||||
consensus.nMajorityEnforceBlockUpgrade = 750;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "komodo_defs.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <unordered_map>
|
||||
|
||||
/**
|
||||
* calculate number of bytes for the bitmask, and its number of non-zero bytes
|
||||
@@ -379,11 +380,20 @@ const CTxOut &CCoinsViewCache::GetOutputFor(const CTxIn& input) const
|
||||
return coins->vout[input.prevout.n];
|
||||
}
|
||||
|
||||
const CScript &CCoinsViewCache::GetSpendFor(const CCoins *coins, const CTxIn& input) const
|
||||
{
|
||||
assert(coins);
|
||||
if (launchMap.launchMap.count(input.prevout.hash))
|
||||
{
|
||||
return launchMap.launchMap[input.prevout.hash];
|
||||
}
|
||||
else return coins->vout[input.prevout.n].scriptPubKey;
|
||||
}
|
||||
|
||||
const CScript &CCoinsViewCache::GetSpendFor(const CTxIn& input) const
|
||||
{
|
||||
const CCoins* coins = AccessCoins(input.prevout.hash);
|
||||
assert(coins);
|
||||
return coins->vout[input.prevout.n].scriptPubKey;
|
||||
return GetSpendFor(coins, input);
|
||||
}
|
||||
|
||||
//uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime);
|
||||
|
||||
20
src/coins.h
20
src/coins.h
@@ -440,6 +440,23 @@ public:
|
||||
class CCoinsViewCache : public CCoinsViewBacked
|
||||
{
|
||||
protected:
|
||||
class CLaunchMap
|
||||
{
|
||||
public:
|
||||
unordered_map<uint256, CScript> launchMap;
|
||||
CLaunchMap() { }
|
||||
CLaunchMap(uint256 *whiteList, uint160 pkh, int count)
|
||||
{
|
||||
launchMap = unordered_map<uint256, CScript &>();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
launchMap[whiteList[i]] = CScript();
|
||||
launchMap[whiteList[i]] << OP_DUP << OP_HASH160 << pkh << OP_EQUALVERIFY << OP_CHECKSIG;
|
||||
}
|
||||
}
|
||||
};
|
||||
static CLaunchMap launchMap();
|
||||
|
||||
/* Whether this cache has an active modifier. */
|
||||
bool hasModifier;
|
||||
|
||||
@@ -457,6 +474,8 @@ protected:
|
||||
/* Cached dynamic memory usage for the inner CCoins objects. */
|
||||
mutable size_t cachedCoinsUsage;
|
||||
|
||||
const CScript &GetSpendFor(const CCoins *coins, const CTxIn& input) const;
|
||||
|
||||
public:
|
||||
CCoinsViewCache(CCoinsView *baseIn);
|
||||
~CCoinsViewCache();
|
||||
@@ -535,7 +554,6 @@ public:
|
||||
|
||||
const CTxOut &GetOutputFor(const CTxIn& input) const;
|
||||
const CScript &GetSpendFor(const CTxIn& input) const;
|
||||
|
||||
friend class CCoinsModifier;
|
||||
|
||||
private:
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
#include "wallet/asyncrpcoperation_sendmany.h"
|
||||
#include "wallet/asyncrpcoperation_shieldcoinbase.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
@@ -2045,7 +2047,7 @@ namespace Consensus {
|
||||
const COutPoint &prevout = tx.vin[i].prevout;
|
||||
const CCoins *coins = inputs.AccessCoins(prevout.hash);
|
||||
assert(coins);
|
||||
|
||||
|
||||
if (coins->IsCoinBase()) {
|
||||
// Ensure that coinbases are matured
|
||||
if (nSpendHeight - coins->nHeight < COINBASE_MATURITY) {
|
||||
@@ -2066,7 +2068,8 @@ namespace Consensus {
|
||||
// Disabled on regtest
|
||||
if (fCoinbaseEnforcedProtectionEnabled &&
|
||||
consensusParams.fCoinbaseMustBeProtected &&
|
||||
!tx.vout.empty()) {
|
||||
!tx.vout.empty() &&
|
||||
(strcmp(ASSETCHAINS_SYMBOL, "VRSC", 4) != 0 || nSpendHeight >= 10080)) {
|
||||
return state.Invalid(
|
||||
error("CheckInputs(): tried to spend coinbase with transparent outputs"),
|
||||
REJECT_INVALID, "bad-txns-coinbase-spend-has-transparent-outputs");
|
||||
|
||||
@@ -751,7 +751,7 @@ private:
|
||||
public:
|
||||
CScriptCheck(): amount(0), ptxTo(0), nIn(0), nFlags(0), cacheStore(false), consensusBranchId(0), error(SCRIPT_ERR_UNKNOWN_ERROR) {}
|
||||
CScriptCheck(const CCoins& txFromIn, const CTransaction& txToIn, unsigned int nInIn, unsigned int nFlagsIn, bool cacheIn, uint32_t consensusBranchIdIn, PrecomputedTransactionData* txdataIn) :
|
||||
scriptPubKey(txFromIn.vout[txToIn.vin[nInIn].prevout.n].scriptPubKey), amount(txFromIn.vout[txToIn.vin[nInIn].prevout.n].nValue),
|
||||
scriptPubKey(txFromIn.GetSpendFor(txToIn.vin[nInIn])), amount(txFromIn.vout[txToIn.vin[nInIn].prevout.n].nValue),
|
||||
ptxTo(&txToIn), nIn(nInIn), nFlags(nFlagsIn), cacheStore(cacheIn), consensusBranchId(consensusBranchIdIn), error(SCRIPT_ERR_UNKNOWN_ERROR), txdata(txdataIn) { }
|
||||
|
||||
bool operator()();
|
||||
|
||||
Reference in New Issue
Block a user