Merge branch 'dev' of github.com:VerusCoin/VerusCoin into dev

This commit is contained in:
David L. Dawes
2018-05-26 14:58:08 -07:00
17 changed files with 158 additions and 51 deletions

View File

@@ -22,36 +22,27 @@ cache:
matrix: matrix:
fast_finish: true fast_finish: true
include: include:
- compiler: ": Linux"
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
' - compiler: ": Mac"
- compiler: ": Windows" os: osx
env: 'HOST=x86_64-w64-mingw32 TARGET_PLATFORM=Win64 RUST_TARGET=x86_64-pc-windows-gnu osx_image: xcode9.2
BUILD_SCRIPT=build-win.sh PACKAGES="build-essential pkg-config libcurl3-gnutls-dev env: 'HOST=x86_64-apple-darwin11 TARGET=x86_64-apple-darwin BUILD_SCRIPT=build-mac.sh
libc6-dev libevent-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git TRAVIS_OS_NAME=osx PACKAGES="binutils protobuf autogen" OSX_SDK=10.9
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
'
exclude: exclude:
- compiler: gcc - compiler: gcc
install: install:
- if [ ! -d "$HOME/google-cloud-sdk/bin" ]; then rm -rf $HOME/google-cloud-sdk; export
CLOUDSDK_CORE_DISABLE_PROMPTS=1; curl https://sdk.cloud.google.com | bash; fi
- source /home/travis/google-cloud-sdk/path.bash.inc
- sudo rm -f /etc/apt/sources.list.d/travis_ci_zeromq3-source.list
- travis_retry sudo apt-get -y update && sudo apt-get -y install -qq $PACKAGES
- if [ $TARGET_PLATFORM = Win64 ]; then curl -sSf https://build.travis-ci.org/files/rustup-init.sh - if [ $TARGET_PLATFORM = Win64 ]; then curl -sSf https://build.travis-ci.org/files/rustup-init.sh
| sh -s -- --default-toolchain stable -y && export PATH=$PATH:$HOME/.cargo/bin:$PATH; | sh -s -- --default-toolchain stable -y && export PATH=$PATH:$HOME/.cargo/bin:$PATH;
fi fi
- if [ $TARGET_PLATFORM = Win64 ]; then rustup target add $RUST_TARGET; fi - if [ $TARGET_PLATFORM = Win64 ]; then rustup target add $RUST_TARGET; fi
- if [ $TRAVIS_OS_NAME = osx ]; then brew upgrade python coreutils automake; fi
- if [ $TRAVIS_OS_NAME = osx ]; then travis_retry brew tap discoteq/discoteq && brew
install flock; fi
- if [ $TRAVIS_OS_NAME = osx ]; then rm '/usr/local/include/c++' && travis_retry brew
tap homebrew/homebrew-core && brew install homebrew/homebrew-core/gcc@5 --overwrite
gcc@5; fi
- if [ $TRAVIS_OS_NAME = osx ]; then travis_retry brew update && brew install $PACKAGES;
fi
before_script: before_script:
- unset CC; unset CXX - unset CC; unset CXX
- mkdir -p depends/SDKs depends/sdk-sources - mkdir -p depends/SDKs depends/sdk-sources
@@ -61,13 +52,10 @@ script:
after_script: after_script:
- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gcloud auth activate-service-account - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gcloud auth activate-service-account
--key-file AUTH_KEY.json; fi --key-file AUTH_KEY.json; fi
- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then mkdir -p src/$KOMODO_BUILD_DIR && cp $KOMODO_EXEC_SET - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp gs://$BUCKET/CI-TESTS/$PROJECT/$TRAVIS_BRANCH/$TARGET_PLATFORM.tar.gz
src/$KOMODO_BUILD_DIR && cd src && tar -czvf $COMPRESSED_BUILD $KOMODO_BUILD_DIR; fi . && tar -xzvf $TARGET_PLATFORM.tar.gz && ls && rm $TARGET_PLATFORM.tar.gz; fi
- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp $COMPRESSED_BUILD gs://$BUCKET/$PROJECT/$TRAVIS_BRANCH/$TARGET_PLATFORM/; - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cp -rv $KOMODO_EXEC_SET $TARGET_PLATFORM
fi && cd src && tar -czvf $TARGET_PLATFORM.tar.gz $TARGET_PLATFORM; fi
notifications: - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gsutil cp -rv $TARGET_PLATFORM.tar.gz
slack: gs://$BUCKET/CI-TESTS/$PROJECT/$TRAVIS_BRANCH/; fi
secure: A7JtO9RXl0Tgx09IWwUKbCuZ0oTC4wM4jthsV2CW3AS7r5Iz1qMFBnb7sb8744f40vi/QYjbr1KHkdOEbSJqWzOJS7oelSM9kyck808un7zZ8OwweXdGqdirNmIR3x+IQAYZw2lvYZcUBX/5h8eXK2LU67Rsve5I1WRGPtz0rmctFeRG6Xe0yGpMDYYxt4Ce/L7N5h3cC2eak8pQU6mSyQog0yvbiM73CFzz//bWughamOHKLx6o8BDgklwuCuh4rHQe/0kwVq1AoPQMqxuKQTsGAmub4mrDcsde39h3uo4GjAqAgfmL2e4hyp8fumdd7BtrQaFF4UBqyR8Xo/Ao97Ca7Dbeii5Eq7sl5/sTxZRdjy+MFD7z+jFpLkXfivBradyu0jABT5YYYMzZOCkpOGl5l3YymT86HKO5RBHyZLNL06jxHLti3NYBvFC6C+0yZrJOo7KN9DMqHHLZ5Y3ASZqbARWlVDE4oQmauyn4X2d6EOoE7ohwHwpY/LbVNFmrGvD+jAf4dOttwCMoWnT2pLWzs8Tl4FrvDGR3tbmZSCR/0NfbbeGrv9YNJtUghjubp1OikaZ3/Hs0+yJVsKo3kVd+dZvT/5u9MD6bu/cSdBRnoG0orca9QB8obaTEQ+71XC63D0hwDoZ9IgX6qVv+3KFErHZdZGiQBZI2yXSckvI=
before_install:
- openssl aes-256-cbc -K $encrypted_11153c0bb86c_key -iv $encrypted_11153c0bb86c_iv
-in AUTH_KEY.json.enc -out AUTH_KEY.json -d

Binary file not shown.

View File

@@ -69,6 +69,26 @@ Building for Windows:
./zcutil/build-win.sh ./zcutil/build-win.sh
``` ```
Building
--------
First time you'll need to get assorted startup values downloaded. This takes a moderate amount of time once but then does niot need to be repeated unless you bring a new system up. The command is:
```
./zcutil/fetch-params.sh
```
Building for Ubunutu/Mint:
```
./zcutil/build.sh
```
Building for Mac OS/X:
```
./zcutil/build-mac.sh
```
Building for Windows:
```
./zcutil/build-win.sh
```
Komodo Komodo
------ ------
We have a release process that goes through several stages before it reaches master. This allows the most conservative users just use the master branch, which is only updated after the other branches have signed off on a release. We have a release process that goes through several stages before it reaches master. This allows the most conservative users just use the master branch, which is only updated after the other branches have signed off on a release.

View File

@@ -302,6 +302,14 @@ bool CBitcoinAddress::GetKeyID(CKeyID& keyID) const
return true; return true;
} }
bool CBitcoinAddress::GetKeyID_NoCheck(CKeyID& keyID) const
{
uint160 id;
memcpy(&id, &vchData[0], 20);
keyID = CKeyID(id);
return true;
}
bool CBitcoinAddress::IsScript() const bool CBitcoinAddress::IsScript() const
{ {
return IsValid() && vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS); return IsValid() && vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS);

View File

@@ -163,6 +163,7 @@ public:
CTxDestination Get() const; CTxDestination Get() const;
bool GetKeyID(CKeyID &keyID) const; bool GetKeyID(CKeyID &keyID) const;
bool GetKeyID_NoCheck(CKeyID& keyID) const;
bool GetIndexKey(uint160& hashBytes, int& type) const; bool GetIndexKey(uint160& hashBytes, int& type) const;
bool IsScript() const; bool IsScript() const;
}; };

View File

@@ -92,7 +92,7 @@ public:
{ {
strNetworkID = "main"; strNetworkID = "main";
strCurrencyUnits = "KMD"; strCurrencyUnits = "KMD";
consensus.fCoinbaseMustBeProtected = false;//true; consensus.fCoinbaseMustBeProtected = true; // this is only enforced after block 12800 on Verus
consensus.nSubsidySlowStartInterval = 20000; consensus.nSubsidySlowStartInterval = 20000;
consensus.nSubsidyHalvingInterval = 840000; consensus.nSubsidyHalvingInterval = 840000;
consensus.nMajorityEnforceBlockUpgrade = 750; consensus.nMajorityEnforceBlockUpgrade = 750;

View File

@@ -379,17 +379,30 @@ const CTxOut &CCoinsViewCache::GetOutputFor(const CTxIn& input) const
return coins->vout[input.prevout.n]; 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_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); 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]; 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 CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTransaction& tx,uint32_t tiptime) const
{ {
if ( interestp != 0 ) if ( interestp != 0 )

View File

@@ -13,13 +13,18 @@
#include "memusage.h" #include "memusage.h"
#include "serialize.h" #include "serialize.h"
#include "uint256.h" #include "uint256.h"
#include "base58.h"
#include "pubkey.h"
#include <assert.h> #include <assert.h>
#include <stdint.h> #include <stdint.h>
#include <vector>
#include <unordered_map>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
#include "zcash/IncrementalMerkleTree.hpp" #include "zcash/IncrementalMerkleTree.hpp"
#include "veruslaunch.h"
/** /**
* Pruned version of CTransaction: only retains metadata and unspent transaction outputs * Pruned version of CTransaction: only retains metadata and unspent transaction outputs
@@ -436,6 +441,29 @@ public:
friend class CCoinsViewCache; friend class CCoinsViewCache;
}; };
class CLaunchMap
{
public:
std::unordered_map<std::string, CScript> lmap;
CLaunchMap() : lmap()
{
for (int i = 0; i < WHITELIST_COUNT; i++)
{
printf("txid: %s -> addr: %s", whitelist_ids[i], whitelist_addrs[i]);
CBitcoinAddress address(whitelist_addrs[i]);
CKeyID key;
if (address.GetKeyID_NoCheck(key))
{
std::vector<unsigned char> adr = std::vector<unsigned char>(key.begin(), key.end());
std::string hash = uint256S(whitelist_ids[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 */ /** CCoinsView that adds a memory cache for transactions to another CCoinsView */
class CCoinsViewCache : public CCoinsViewBacked class CCoinsViewCache : public CCoinsViewBacked
{ {
@@ -443,7 +471,6 @@ protected:
/* Whether this cache has an active modifier. */ /* Whether this cache has an active modifier. */
bool hasModifier; bool hasModifier;
/** /**
* Make mutable so that we can "fill the cache" even from Get-methods * Make mutable so that we can "fill the cache" even from Get-methods
* declared as "const". * declared as "const".
@@ -462,6 +489,7 @@ public:
~CCoinsViewCache(); ~CCoinsViewCache();
// Standard CCoinsView methods // Standard CCoinsView methods
static CLaunchMap &LaunchMap() { return launchMap; }
bool GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tree) const; bool GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tree) const;
bool GetNullifier(const uint256 &nullifier) const; bool GetNullifier(const uint256 &nullifier) const;
bool GetCoins(const uint256 &txid, CCoins &coins) const; bool GetCoins(const uint256 &txid, CCoins &coins) const;
@@ -535,6 +563,7 @@ public:
const CTxOut &GetOutputFor(const CTxIn& input) const; const CTxOut &GetOutputFor(const CTxIn& input) const;
const CScript &GetSpendFor(const CTxIn& input) const; const CScript &GetSpendFor(const CTxIn& input) const;
static const CScript &GetSpendFor(const CCoins *coins, const CTxIn& input);
friend class CCoinsModifier; friend class CCoinsModifier;

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

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

View File

@@ -1330,7 +1330,7 @@ bool verusCheckPOSBlock(int32_t slowflag, CBlock *pblock, int32_t height)
strcpy(voutaddr, CBitcoinAddress(voutaddress).ToString().c_str()); strcpy(voutaddr, CBitcoinAddress(voutaddress).ToString().c_str());
strcpy(destaddr, CBitcoinAddress(destaddress).ToString().c_str()); strcpy(destaddr, CBitcoinAddress(destaddress).ToString().c_str());
strcpy(cbaddr, CBitcoinAddress(cbaddress).ToString().c_str()); strcpy(cbaddr, CBitcoinAddress(cbaddress).ToString().c_str());
if ( !strcmp(destaddr,voutaddr) && ( !strcmp(destaddr,cbaddr) || (height < 10080)) ) if ( !strcmp(destaddr,voutaddr) && ( !strcmp(destaddr,cbaddr) || (height < 12800)) )
{ {
isPOS = true; isPOS = true;
} }

View File

@@ -1052,11 +1052,20 @@ int64_t komodo_block_unlocktime(uint32_t nHeight)
unlocktime = ASSETCHAINS_TIMEUNLOCKTO; unlocktime = ASSETCHAINS_TIMEUNLOCKTO;
else else
{ {
unlocktime = komodo_block_prg(nHeight) / (0xffffffffffffffff / ((ASSETCHAINS_TIMEUNLOCKTO - ASSETCHAINS_TIMEUNLOCKFROM) + 1)); if (strcmp(ASSETCHAINS_SYMBOL, "VRSC") != 0 || nHeight >= 12800)
// boundary and power of 2 can make it exceed to time by 1 {
unlocktime = unlocktime + ASSETCHAINS_TIMEUNLOCKFROM; unlocktime = komodo_block_prg(nHeight) % (ASSETCHAINS_TIMEUNLOCKTO - ASSETCHAINS_TIMEUNLOCKFROM);
if (unlocktime > ASSETCHAINS_TIMEUNLOCKTO) // boundary and power of 2 can make it exceed to time by 1
unlocktime--; unlocktime = unlocktime + ASSETCHAINS_TIMEUNLOCKFROM;
}
else
{
unlocktime = komodo_block_prg(nHeight) / (0xffffffffffffffff / ((ASSETCHAINS_TIMEUNLOCKTO - ASSETCHAINS_TIMEUNLOCKFROM) + 1));
// boundary and power of 2 can make it exceed to time by 1
unlocktime = unlocktime + ASSETCHAINS_TIMEUNLOCKFROM;
if (unlocktime > ASSETCHAINS_TIMEUNLOCKTO)
unlocktime--;
}
} }
return ((int64_t)unlocktime); return ((int64_t)unlocktime);
} }

View File

@@ -31,7 +31,9 @@
#include "wallet/asyncrpcoperation_sendmany.h" #include "wallet/asyncrpcoperation_sendmany.h"
#include "wallet/asyncrpcoperation_shieldcoinbase.h" #include "wallet/asyncrpcoperation_shieldcoinbase.h"
#include <cstring>
#include <sstream> #include <sstream>
#include <unordered_map>
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
@@ -2066,7 +2068,8 @@ namespace Consensus {
// Disabled on regtest // Disabled on regtest
if (fCoinbaseEnforcedProtectionEnabled && if (fCoinbaseEnforcedProtectionEnabled &&
consensusParams.fCoinbaseMustBeProtected && consensusParams.fCoinbaseMustBeProtected &&
!tx.vout.empty()) { !tx.vout.empty() &&
(strcmp(ASSETCHAINS_SYMBOL, "VRSC") != 0 || (nSpendHeight >= 12800 && coins->nHeight >= 12800))) {
return state.Invalid( return state.Invalid(
error("CheckInputs(): tried to spend coinbase with transparent outputs"), error("CheckInputs(): tried to spend coinbase with transparent outputs"),
REJECT_INVALID, "bad-txns-coinbase-spend-has-transparent-outputs"); REJECT_INVALID, "bad-txns-coinbase-spend-has-transparent-outputs");

View File

@@ -751,7 +751,7 @@ private:
public: public:
CScriptCheck(): amount(0), ptxTo(0), nIn(0), nFlags(0), cacheStore(false), consensusBranchId(0), error(SCRIPT_ERR_UNKNOWN_ERROR) {} 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) : 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) { } ptxTo(&txToIn), nIn(nInIn), nFlags(nFlagsIn), cacheStore(cacheIn), consensusBranchId(consensusBranchIdIn), error(SCRIPT_ERR_UNKNOWN_ERROR), txdata(txdataIn) { }
bool operator()(); bool operator()();

View File

@@ -25,7 +25,13 @@
#include <assert.h> #include <assert.h>
typedef uint16_t u16; typedef uint16_t u16;
#ifdef _WIN32
typedef unsigned long long u64;
#elif __linux__
typedef uint64_t u64; typedef uint64_t u64;
#else
typedef unsigned long u64;
#endif
#ifdef EQUIHASH_TROMP_ATOMIC #ifdef EQUIHASH_TROMP_ATOMIC
#include <atomic> #include <atomic>

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

12
src/veruslaunch.cpp Normal file
View File

@@ -0,0 +1,12 @@
// Copyright (c) 2018 The Verus developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <string>
#include <cstring>
#include "veruslaunch.h"
const char *whitelist_ids[WHITELIST_COUNT] = {};
const char *whitelist_addrs[WHITELIST_COUNT] = {};

16
src/veruslaunch.h Normal file
View File

@@ -0,0 +1,16 @@
// Copyright (c) 2018 The Verus developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef VERUS_LAUNCH_H
#define VERUS_LAUNCH_H
#include <string>
#define WHITELIST_COUNT 0
extern const char *whitelist_ids[WHITELIST_COUNT];
extern const char *whitelist_addrs[WHITELIST_COUNT];
#endif