{
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;
#include "komodo_defs.h"
#include <assert.h>
+#include <unordered_map>
/**
* calculate number of bytes for the bitmask, and its number of non-zero bytes
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);
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;
/* 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();
const CTxOut &GetOutputFor(const CTxIn& input) const;
const CScript &GetSpendFor(const CTxIn& input) const;
-
friend class CCoinsModifier;
private:
#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>
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) {
// 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");
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()();