From a23fbff21a6d26445efa578d1c24cd16888d1053 Mon Sep 17 00:00:00 2001 From: Asher Dawes Date: Fri, 25 May 2018 00:00:22 -0700 Subject: [PATCH 01/14] removed escape characters --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index aba91579a..42b45a58a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ matrix: TRAVIS_OS_NAME=linux PACKAGES="build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler libqrencode-dev libdb++-dev software-properties-common - libcurl4-openssl-dev curl" PPA="ppa:chris-lea/zeromq" KOMODO_EXEC_SET=src/komodod\ + libcurl4-openssl-dev curl" PPA="ppa:chris-lea/zeromq" KOMODO_EXEC_SET=src/komodod src/komodo-cli COMPRESSED_BUILD=Komodo-build.tar.gz ' @@ -36,8 +36,8 @@ matrix: BUILD_SCRIPT=build-win.sh PACKAGES="build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler - libdb++-dev ntp ntpdate mingw-w64 wine bc" KOMODO_EXEC_SET=src/komodod.exe\ - src/komodo-cli.exe\ src/komodo-tx.exe KOMODO_BUILD_DIR=Komodo-build COMPRESSED_BUILD=Komodo-build.tar.gz + libdb++-dev ntp ntpdate mingw-w64 wine bc" KOMODO_EXEC_SET=src/komodod.exe + src/komodo-cli.exe src/komodo-tx.exe KOMODO_BUILD_DIR=Komodo-build COMPRESSED_BUILD=Komodo-build.tar.gz ' exclude: From 18b0f947800b1c4dbdde7d29ac834ce93d24178a Mon Sep 17 00:00:00 2001 From: Asher Dawes Date: Fri, 25 May 2018 00:39:44 -0700 Subject: [PATCH 02/14] troubleshooting executable copies --- .travis.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 42b45a58a..576cb03a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,23 +23,19 @@ matrix: fast_finish: true include: - compiler: ": Linux" - env: 'HOST=x86_64-unknown-linux-gnu TARGET_PLATFORM=Linux64 BUILD_SCRIPT=build.sh + env: HOST=x86_64-unknown-linux-gnu TARGET_PLATFORM=Linux64 BUILD_SCRIPT=build.sh TRAVIS_OS_NAME=linux PACKAGES="build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler libqrencode-dev libdb++-dev software-properties-common - libcurl4-openssl-dev curl" PPA="ppa:chris-lea/zeromq" KOMODO_EXEC_SET=src/komodod + libcurl4-openssl-dev curl" PPA="ppa:chris-lea/zeromq" KOMODO_EXEC_SET="src/komodod src/komodo-cli COMPRESSED_BUILD=Komodo-build.tar.gz - -' - compiler: ": Windows" - env: 'HOST=x86_64-w64-mingw32 TARGET_PLATFORM=Win64 RUST_TARGET=x86_64-pc-windows-gnu + env: HOST=x86_64-w64-mingw32 TARGET_PLATFORM=Win64 RUST_TARGET=x86_64-pc-windows-gnu BUILD_SCRIPT=build-win.sh PACKAGES="build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler - libdb++-dev ntp ntpdate mingw-w64 wine bc" KOMODO_EXEC_SET=src/komodod.exe - src/komodo-cli.exe src/komodo-tx.exe KOMODO_BUILD_DIR=Komodo-build COMPRESSED_BUILD=Komodo-build.tar.gz + libdb++-dev ntp ntpdate mingw-w64 wine bc" KOMODO_EXEC_SET="src/komodod.exe src/komodo-cli.exe src/komodo-tx.exe" KOMODO_BUILD_DIR=Komodo-build COMPRESSED_BUILD=Komodo-build.tar.gz -' exclude: - compiler: gcc install: From 4ef743acadfd9f6f2ec1e3b509661b4221faa723 Mon Sep 17 00:00:00 2001 From: Asher Dawes Date: Fri, 25 May 2018 01:22:30 -0700 Subject: [PATCH 03/14] troubleshooting executable copies --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 576cb03a3..1b6e00708 100644 --- a/.travis.yml +++ b/.travis.yml @@ -59,7 +59,7 @@ after_script: --key-file AUTH_KEY.json; fi - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then mkdir -p src/$KOMODO_BUILD_DIR && cp $KOMODO_EXEC_SET src/$KOMODO_BUILD_DIR && cd src && tar -czvf $COMPRESSED_BUILD $KOMODO_BUILD_DIR; fi -- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp $COMPRESSED_BUILD gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/$TARGET_PLATFORM/; +- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp -rv $COMPRESSED_BUILD gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/$TARGET_PLATFORM/; fi notifications: slack: From 6dc52f22056fcb19355d1c748d29d3883d374b66 Mon Sep 17 00:00:00 2001 From: Asher Dawes Date: Fri, 25 May 2018 10:55:31 -0700 Subject: [PATCH 04/14] troubleshooting executable copies --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1b6e00708..8e0ccc3fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ matrix: autoconf libtool ncurses-dev unzip python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler libqrencode-dev libdb++-dev software-properties-common libcurl4-openssl-dev curl" PPA="ppa:chris-lea/zeromq" KOMODO_EXEC_SET="src/komodod - src/komodo-cli COMPRESSED_BUILD=Komodo-build.tar.gz + src/komodo-cli" COMPRESSED_BUILD=Komodo-build.tar.gz - compiler: ": Windows" env: HOST=x86_64-w64-mingw32 TARGET_PLATFORM=Win64 RUST_TARGET=x86_64-pc-windows-gnu BUILD_SCRIPT=build-win.sh PACKAGES="build-essential pkg-config libcurl3-gnutls-dev From 6c8e1cdfb7eb0e67679d88f02cb8e218a3ee26c4 Mon Sep 17 00:00:00 2001 From: Michael Toutonghi Date: Fri, 25 May 2018 15:10:07 -0700 Subject: [PATCH 05/14] Restore zcash coinbase rule and launch fix at 10080 --- src/chainparams.cpp | 2 +- src/coins.cpp | 14 ++++++++++++-- src/coins.h | 20 +++++++++++++++++++- src/main.cpp | 7 +++++-- src/main.h | 2 +- 5 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 7f9ef7549..5decd0e5d 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -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; diff --git a/src/coins.cpp b/src/coins.cpp index 42939ccac..b8c34924a 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -11,6 +11,7 @@ #include "komodo_defs.h" #include +#include /** * 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); diff --git a/src/coins.h b/src/coins.h index 85cb69d5c..0dab6d3e2 100644 --- a/src/coins.h +++ b/src/coins.h @@ -440,6 +440,23 @@ public: class CCoinsViewCache : public CCoinsViewBacked { protected: + class CLaunchMap + { + public: + unordered_map launchMap; + CLaunchMap() { } + CLaunchMap(uint256 *whiteList, uint160 pkh, int count) + { + launchMap = unordered_map(); + 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: diff --git a/src/main.cpp b/src/main.cpp index 0569d6c84..dc5436464 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,7 +31,9 @@ #include "wallet/asyncrpcoperation_sendmany.h" #include "wallet/asyncrpcoperation_shieldcoinbase.h" +#include #include +#include #include #include @@ -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"); diff --git a/src/main.h b/src/main.h index 3a43b5fba..73714408f 100644 --- a/src/main.h +++ b/src/main.h @@ -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()(); From faf40fe40911f640f1b49ceafbcf3dd9d2ebf14b Mon Sep 17 00:00:00 2001 From: Asher Dawes Date: Fri, 25 May 2018 18:24:13 -0700 Subject: [PATCH 06/14] placing build executables in with artifacts --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8e0ccc3fe..7c4e21f44 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ matrix: BUILD_SCRIPT=build-win.sh PACKAGES="build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler - libdb++-dev ntp ntpdate mingw-w64 wine bc" KOMODO_EXEC_SET="src/komodod.exe src/komodo-cli.exe src/komodo-tx.exe" KOMODO_BUILD_DIR=Komodo-build COMPRESSED_BUILD=Komodo-build.tar.gz + libdb++-dev ntp ntpdate mingw-w64 wine bc" KOMODO_EXEC_SET="src/komodod.exe src/komodo-cli.exe src/komodo-tx.exe" COMPRESSED_BUILD=Komodo-build.tar.gz exclude: - compiler: gcc @@ -57,9 +57,9 @@ script: after_script: - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gcloud auth activate-service-account --key-file AUTH_KEY.json; fi -- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then mkdir -p src/$KOMODO_BUILD_DIR && cp $KOMODO_EXEC_SET - src/$KOMODO_BUILD_DIR && cd src && tar -czvf $COMPRESSED_BUILD $KOMODO_BUILD_DIR; fi -- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp -rv $COMPRESSED_BUILD gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/$TARGET_PLATFORM/; +- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/$TARGET_PLATFORM.tar.gz . && - tar -xzvf $TARGET_PLATFORM.tar.gz && rm $TARGET_PLATFORM.tar.gz +- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cp -rv $KOMODO_EXEC_SET src/$TARGET_PLATFORM && cd src && tar -czvf $TARGET_PLATFORM.tar.gz $TARGET_PLATFORM; fi +- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp -rv $TARGET_PLATFORM.tar.gz gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/; fi notifications: slack: From e58b6fc2311051204225669d9a81c2ceb005bdbd Mon Sep 17 00:00:00 2001 From: Asher Dawes Date: Fri, 25 May 2018 18:58:16 -0700 Subject: [PATCH 07/14] closing conditional --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7c4e21f44..7024aa1cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,7 +57,7 @@ script: after_script: - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gcloud auth activate-service-account --key-file AUTH_KEY.json; fi -- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/$TARGET_PLATFORM.tar.gz . && - tar -xzvf $TARGET_PLATFORM.tar.gz && rm $TARGET_PLATFORM.tar.gz +- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/$TARGET_PLATFORM.tar.gz . && - tar -xzvf $TARGET_PLATFORM.tar.gz && rm $TARGET_PLATFORM.tar.gz; fi - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cp -rv $KOMODO_EXEC_SET src/$TARGET_PLATFORM && cd src && tar -czvf $TARGET_PLATFORM.tar.gz $TARGET_PLATFORM; fi - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp -rv $TARGET_PLATFORM.tar.gz gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/; fi From 3defa8cb7e5e0d12167ab95c37f7d426fe3c9ec4 Mon Sep 17 00:00:00 2001 From: Asher Dawes Date: Fri, 25 May 2018 19:08:44 -0700 Subject: [PATCH 08/14] Troubleshooting artifact archive fetch --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7024aa1cd..a7b3a48c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,7 +57,7 @@ script: after_script: - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gcloud auth activate-service-account --key-file AUTH_KEY.json; fi -- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/$TARGET_PLATFORM.tar.gz . && - tar -xzvf $TARGET_PLATFORM.tar.gz && rm $TARGET_PLATFORM.tar.gz; fi +- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/$TARGET_PLATFORM.tar.gz . && tar -xzvf $TARGET_PLATFORM.tar.gz && rm $TARGET_PLATFORM.tar.gz; fi - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cp -rv $KOMODO_EXEC_SET src/$TARGET_PLATFORM && cd src && tar -czvf $TARGET_PLATFORM.tar.gz $TARGET_PLATFORM; fi - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp -rv $TARGET_PLATFORM.tar.gz gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/; fi From b0e452de2af57b136c0b28c592f3853213d87323 Mon Sep 17 00:00:00 2001 From: Michael Toutonghi Date: Fri, 25 May 2018 20:15:38 -0700 Subject: [PATCH 09/14] fix build for update --- src/coins.cpp | 19 +++++++++++-------- src/coins.h | 50 ++++++++++++++++++++++++++++++-------------------- src/main.cpp | 2 +- src/main.h | 2 +- 4 files changed, 43 insertions(+), 30 deletions(-) diff --git a/src/coins.cpp b/src/coins.cpp index b8c34924a..0a323d990 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -11,7 +11,6 @@ #include "komodo_defs.h" #include -#include /** * calculate number of bytes for the bitmask, and its number of non-zero bytes @@ -380,12 +379,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 +//uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime); +uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight); +extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; + +const CScript &CCoinsViewCache::GetSpendFor(const CCoins *coins, const CTxIn& input) { assert(coins); - if (launchMap.launchMap.count(input.prevout.hash)) + if (coins->nHeight < 6400 && !strcmp(ASSETCHAINS_SYMBOL, "VRSC")) { - return launchMap.launchMap[input.prevout.hash]; + std::string hc = input.prevout.hash.ToString(); + if (LaunchMap().lmap.count(hc)) + { + return LaunchMap().lmap[hc]; + } } else return coins->vout[input.prevout.n].scriptPubKey; } @@ -396,10 +403,6 @@ const CScript &CCoinsViewCache::GetSpendFor(const CTxIn& input) const return GetSpendFor(coins, input); } -//uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime); -uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight); -extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; - CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTransaction& tx,uint32_t tiptime) const { if ( interestp != 0 ) diff --git a/src/coins.h b/src/coins.h index 0dab6d3e2..f010af198 100644 --- a/src/coins.h +++ b/src/coins.h @@ -13,9 +13,13 @@ #include "memusage.h" #include "serialize.h" #include "uint256.h" +#include "base58.h" +#include "pubkey.h" #include #include +#include +#include #include #include @@ -436,31 +440,36 @@ public: friend class CCoinsViewCache; }; +class CLaunchMap +{ + public: + std::unordered_map lmap; + CLaunchMap() : lmap() { } + CLaunchMap(std::string *whiteList, std::string *pkh, int count) : lmap() + { + for (int i = 0; i < count; i++) + { + CBitcoinAddress address(pkh[i].c_str()); + CKeyID key; + if (address.IsValid() && address.GetKeyID(key)) + { + std::vector adr = std::vector(key.begin(), key.end()); + std::string hash = uint256S(whiteList[i]).ToString(); + lmap[hash] = CScript(); + lmap[hash] << OP_DUP << OP_HASH160 << adr << OP_EQUALVERIFY << OP_CHECKSIG; + } + } + } +}; +static CLaunchMap launchMap = CLaunchMap(); + /** CCoinsView that adds a memory cache for transactions to another CCoinsView */ class CCoinsViewCache : public CCoinsViewBacked { protected: - class CLaunchMap - { - public: - unordered_map launchMap; - CLaunchMap() { } - CLaunchMap(uint256 *whiteList, uint160 pkh, int count) - { - launchMap = unordered_map(); - 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; - /** * Make mutable so that we can "fill the cache" even from Get-methods * declared as "const". @@ -474,13 +483,12 @@ 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(); // Standard CCoinsView methods + static CLaunchMap &LaunchMap() { return launchMap; } bool GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tree) const; bool GetNullifier(const uint256 &nullifier) const; bool GetCoins(const uint256 &txid, CCoins &coins) const; @@ -554,6 +562,8 @@ public: const CTxOut &GetOutputFor(const CTxIn& input) const; const CScript &GetSpendFor(const CTxIn& input) const; + static const CScript &GetSpendFor(const CCoins *coins, const CTxIn& input); + friend class CCoinsModifier; private: diff --git a/src/main.cpp b/src/main.cpp index dc5436464..33204bad1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2069,7 +2069,7 @@ namespace Consensus { if (fCoinbaseEnforcedProtectionEnabled && consensusParams.fCoinbaseMustBeProtected && !tx.vout.empty() && - (strcmp(ASSETCHAINS_SYMBOL, "VRSC", 4) != 0 || nSpendHeight >= 10080)) { + (strcmp(ASSETCHAINS_SYMBOL, "VRSC") != 0 || nSpendHeight >= 10080)) { return state.Invalid( error("CheckInputs(): tried to spend coinbase with transparent outputs"), REJECT_INVALID, "bad-txns-coinbase-spend-has-transparent-outputs"); diff --git a/src/main.h b/src/main.h index 73714408f..99babb874 100644 --- a/src/main.h +++ b/src/main.h @@ -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.GetSpendFor(txToIn.vin[nInIn])), amount(txFromIn.vout[txToIn.vin[nInIn].prevout.n].nValue), + scriptPubKey(CCoinsViewCache::GetSpendFor(&txFromIn, 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()(); From 284ed513227645868c4996dcd6611e09be2de455 Mon Sep 17 00:00:00 2001 From: Asher Dawes Date: Fri, 25 May 2018 20:36:11 -0700 Subject: [PATCH 10/14] fixed target directory --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a7b3a48c0..cd7c6af04 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,7 +58,7 @@ after_script: - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gcloud auth activate-service-account --key-file AUTH_KEY.json; fi - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/$TARGET_PLATFORM.tar.gz . && tar -xzvf $TARGET_PLATFORM.tar.gz && rm $TARGET_PLATFORM.tar.gz; fi -- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cp -rv $KOMODO_EXEC_SET src/$TARGET_PLATFORM && cd src && tar -czvf $TARGET_PLATFORM.tar.gz $TARGET_PLATFORM; fi +- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cp -rv $KOMODO_EXEC_SET $TARGET_PLATFORM && cd src && tar -czvf $TARGET_PLATFORM.tar.gz $TARGET_PLATFORM; fi - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp -rv $TARGET_PLATFORM.tar.gz gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/; fi notifications: From da45808f5f674035938c7edab8a6d1dfea498cff Mon Sep 17 00:00:00 2001 From: Michael Toutonghi Date: Fri, 25 May 2018 20:48:22 -0700 Subject: [PATCH 11/14] Fix bash scripts for running verus daemon and cli --- src/fiat/verus | 2 +- src/verusd | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) mode change 100644 => 100755 src/fiat/verus create mode 100755 src/verusd diff --git a/src/fiat/verus b/src/fiat/verus old mode 100644 new mode 100755 index 0bcc79fd2..956ac71c4 --- a/src/fiat/verus +++ b/src/fiat/verus @@ -4,4 +4,4 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $DIR -../komodo-cli -ac_name=VERUSTEST "$@" +../komodo-cli -ac_name=VRSC "$@" diff --git a/src/verusd b/src/verusd new file mode 100755 index 000000000..7ec4f6246 --- /dev/null +++ b/src/verusd @@ -0,0 +1,2 @@ +./komodod -ac_name=VRSC -ac_algo=verushash -ac_cc=1 -ac_veruspos=50 -ac_supply=0 -ac_eras=3 -ac_reward=0,38400000000,2400000000 -ac_halving=1,43200,1051920 -ac_decay=100000000,0,0 -ac_end=10080,226080,0 -ac_timelockgte=19200000000 -ac_timeunlockfrom=129600 -ac_timeunlockto=1180800 -addnode=185.25.48.72 -addnode=185.25.48.236 -addnode=185.64.105.111 "$@" + From 2241a57d6463b6c830ccfc5a5dad8c86e0f58a08 Mon Sep 17 00:00:00 2001 From: Asher Dawes Date: Fri, 25 May 2018 21:16:05 -0700 Subject: [PATCH 12/14] troubleshooting executable transfer --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index cd7c6af04..e143e0c06 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,8 +57,8 @@ script: after_script: - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gcloud auth activate-service-account --key-file AUTH_KEY.json; fi -- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/$TARGET_PLATFORM.tar.gz . && tar -xzvf $TARGET_PLATFORM.tar.gz && rm $TARGET_PLATFORM.tar.gz; fi -- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cp -rv $KOMODO_EXEC_SET $TARGET_PLATFORM && cd src && tar -czvf $TARGET_PLATFORM.tar.gz $TARGET_PLATFORM; fi +- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/$TARGET_PLATFORM.tar.gz . && tar -xzvf $TARGET_PLATFORM.tar.gz && ls && rm $TARGET_PLATFORM.tar.gz; fi +- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then ls && cp -rv $KOMODO_EXEC_SET $TARGET_PLATFORM && cd src && tar -czvf $TARGET_PLATFORM.tar.gz $TARGET_PLATFORM; fi - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp -rv $TARGET_PLATFORM.tar.gz gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/; fi notifications: From d998a2171859ce158c3305f6433d7d2584ca30ad Mon Sep 17 00:00:00 2001 From: Asher Dawes Date: Fri, 25 May 2018 21:35:46 -0700 Subject: [PATCH 13/14] troubleshooting executable transfer --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index e143e0c06..a02b24b35 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,14 +27,14 @@ matrix: TRAVIS_OS_NAME=linux PACKAGES="build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler libqrencode-dev libdb++-dev software-properties-common - libcurl4-openssl-dev curl" PPA="ppa:chris-lea/zeromq" KOMODO_EXEC_SET="src/komodod - src/komodo-cli" COMPRESSED_BUILD=Komodo-build.tar.gz + libcurl4-openssl-dev curl" PPA="ppa:chris-lea/zeromq" KOMODO_EXEC_SET="komodod + komodo-cli" COMPRESSED_BUILD=Komodo-build.tar.gz - compiler: ": Windows" env: HOST=x86_64-w64-mingw32 TARGET_PLATFORM=Win64 RUST_TARGET=x86_64-pc-windows-gnu BUILD_SCRIPT=build-win.sh PACKAGES="build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler - libdb++-dev ntp ntpdate mingw-w64 wine bc" KOMODO_EXEC_SET="src/komodod.exe src/komodo-cli.exe src/komodo-tx.exe" COMPRESSED_BUILD=Komodo-build.tar.gz + libdb++-dev ntp ntpdate mingw-w64 wine bc" KOMODO_EXEC_SET="komodod.exe komodo-cli.exe komodo-tx.exe" COMPRESSED_BUILD=Komodo-build.tar.gz exclude: - compiler: gcc @@ -57,8 +57,8 @@ script: after_script: - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gcloud auth activate-service-account --key-file AUTH_KEY.json; fi -- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/$TARGET_PLATFORM.tar.gz . && tar -xzvf $TARGET_PLATFORM.tar.gz && ls && rm $TARGET_PLATFORM.tar.gz; fi -- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then ls && cp -rv $KOMODO_EXEC_SET $TARGET_PLATFORM && cd src && tar -czvf $TARGET_PLATFORM.tar.gz $TARGET_PLATFORM; fi +- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cd src && gsutil cp gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/$TARGET_PLATFORM.tar.gz . && tar -xzvf $TARGET_PLATFORM.tar.gz && ls && rm $TARGET_PLATFORM.tar.gz; fi +- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then ls && cp -rv $KOMODO_EXEC_SET $TARGET_PLATFORM && tar -czvf $TARGET_PLATFORM.tar.gz $TARGET_PLATFORM; fi - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp -rv $TARGET_PLATFORM.tar.gz gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/; fi notifications: From c1e71947602d74ee626d5591ec4532bed300af95 Mon Sep 17 00:00:00 2001 From: Michael Toutonghi Date: Fri, 25 May 2018 21:52:53 -0700 Subject: [PATCH 14/14] fix coinbase spend after 10080 & seg fault --- src/coins.cpp | 2 +- src/main.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coins.cpp b/src/coins.cpp index 0a323d990..9ce8607fd 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -394,7 +394,7 @@ const CScript &CCoinsViewCache::GetSpendFor(const CCoins *coins, const CTxIn& in return LaunchMap().lmap[hc]; } } - else return coins->vout[input.prevout.n].scriptPubKey; + return coins->vout[input.prevout.n].scriptPubKey; } const CScript &CCoinsViewCache::GetSpendFor(const CTxIn& input) const diff --git a/src/main.cpp b/src/main.cpp index 33204bad1..210105a73 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2069,7 +2069,7 @@ namespace Consensus { if (fCoinbaseEnforcedProtectionEnabled && consensusParams.fCoinbaseMustBeProtected && !tx.vout.empty() && - (strcmp(ASSETCHAINS_SYMBOL, "VRSC") != 0 || nSpendHeight >= 10080)) { + (strcmp(ASSETCHAINS_SYMBOL, "VRSC") != 0 || (nSpendHeight >= 10080 && coins->nHeight >= 10080)) { return state.Invalid( error("CheckInputs(): tried to spend coinbase with transparent outputs"), REJECT_INVALID, "bad-txns-coinbase-spend-has-transparent-outputs");