Merge pull request #29 from VerusCoin/dev

merge in post launch fixes
This commit is contained in:
miketout
2018-05-25 22:22:39 -07:00
committed by GitHub
8 changed files with 67 additions and 25 deletions

View File

@@ -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\
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
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="komodod.exe komodo-cli.exe komodo-tx.exe" COMPRESSED_BUILD=Komodo-build.tar.gz
'
exclude:
- compiler: gcc
install:
@@ -61,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 $COMPRESSED_BUILD gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/$TARGET_PLATFORM/;
- 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:
slack:

View File

@@ -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;

View File

@@ -379,17 +379,30 @@ const CTxOut &CCoinsViewCache::GetOutputFor(const CTxIn& input) const
return coins->vout[input.prevout.n];
}
const CScript &CCoinsViewCache::GetSpendFor(const CTxIn& input) const
{
const CCoins* coins = AccessCoins(input.prevout.hash);
assert(coins);
return coins->vout[input.prevout.n].scriptPubKey;
}
//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 (coins->nHeight < 6400 && !strcmp(ASSETCHAINS_SYMBOL, "VRSC"))
{
std::string hc = input.prevout.hash.ToString();
if (LaunchMap().lmap.count(hc))
{
return LaunchMap().lmap[hc];
}
}
return coins->vout[input.prevout.n].scriptPubKey;
}
const CScript &CCoinsViewCache::GetSpendFor(const CTxIn& input) const
{
const CCoins* coins = AccessCoins(input.prevout.hash);
return GetSpendFor(coins, input);
}
CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTransaction& tx,uint32_t tiptime) const
{
if ( interestp != 0 )

View File

@@ -13,9 +13,13 @@
#include "memusage.h"
#include "serialize.h"
#include "uint256.h"
#include "base58.h"
#include "pubkey.h"
#include <assert.h>
#include <stdint.h>
#include <vector>
#include <unordered_map>
#include <boost/foreach.hpp>
#include <boost/unordered_map.hpp>
@@ -436,6 +440,29 @@ public:
friend class CCoinsViewCache;
};
class CLaunchMap
{
public:
std::unordered_map<std::string, CScript> 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<unsigned char> adr = std::vector<unsigned char>(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
{
@@ -443,7 +470,6 @@ protected:
/* 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".
@@ -462,6 +488,7 @@ public:
~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;
@@ -535,6 +562,7 @@ 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;

2
src/fiat/verus Normal file → Executable file
View File

@@ -4,4 +4,4 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
../komodo-cli -ac_name=VERUSTEST "$@"
../komodo-cli -ac_name=VRSC "$@"

View File

@@ -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") != 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");

View File

@@ -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(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()();

2
src/verusd Executable file
View File

@@ -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 "$@"