Browse Source

Merge pull request #457 from VerusCoin/dev

Dev
master v0.9.4-5
Asher Dawes 2 years ago
committed by GitHub
parent
commit
25ed684e88
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .gitlab-ci.yml
  2. 2
      README.md
  3. 2
      doc/man/verus-cli/linux/README.txt
  4. 2
      doc/man/verus-cli/mac/README.txt
  5. 2
      doc/man/verus-cli/windows/README.txt
  6. 47
      src/chainparams.cpp
  7. 2
      src/chainparams.h
  8. 1
      src/consensus/params.h
  9. 2
      src/deprecation.h
  10. 6
      src/init.cpp
  11. 2
      src/komodo_globals.h
  12. 4
      src/main.h
  13. 6
      src/miner.cpp
  14. 2
      src/pbaas/pbaas.cpp
  15. 1
      src/rpc/client.cpp
  16. 32
      src/rpc/misc.cpp
  17. 2
      src/rpc/pbaasrpc.cpp
  18. 2
      src/rpc/server.cpp
  19. 2
      src/version.h

2
.gitlab-ci.yml

@ -7,7 +7,7 @@ stages:
########################################################################################################################
variables:
VERSION: 0.9.4-4
VERSION: 0.9.4-5
VERUS_CLI_ARM64_LINUX: Verus-CLI-Linux-v${VERSION}-arm64.tar.gz
VERUS_CLI_LINUX_X86_64: Verus-CLI-Linux-v${VERSION}-x86_64.tar.gz

2
README.md

@ -1,5 +1,5 @@
## VerusCoin version 0.9.4-4
## VerusCoin version 0.9.4-5
Arguably the world's most advanced technology, zero knowledge privacy-centric blockchain, Verus Coin brings Sapling performance and zero knowledge features to an intelligent system with interchain smart contracts and a completely original, combined proof of stake/proof of work consensus algorithm that solves the nothing at stake problem. With this and its approach towards CPU mining and ASICs, Verus Coin strives to be one of the most naturally decentralizing and attack resistant blockchains in existence.

2
doc/man/verus-cli/linux/README.txt

@ -1,5 +1,5 @@
VerusCoin Command Line Tools v0.9.4-4
VerusCoin Command Line Tools v0.9.4-5
Contents:
verusd - VerusCoin daemon

2
doc/man/verus-cli/mac/README.txt

@ -1,5 +1,5 @@
VerusCoin Command Line Tools v0.9.4-4
VerusCoin Command Line Tools v0.9.4-5
Contents:
verusd - VerusCoin daemon.

2
doc/man/verus-cli/windows/README.txt

@ -1,5 +1,5 @@
VerusCoin Command Line Tools v0.9.4-4
VerusCoin Command Line Tools v0.9.4-5
Contents:
verusd.exe - VerusCoin daemon

47
src/chainparams.cpp

@ -107,12 +107,10 @@ public:
consensus.nEquihashN = N;
consensus.nEquihashK = K;
consensus.nPowAveragingWindow = 17;
consensus.nMaxFutureBlockTime = 7 * 60; // 7 mins
assert(maxUint/UintToArith256(consensus.powLimit) >= consensus.nPowAveragingWindow);
consensus.nPowMaxAdjustDown = 32; // 32% adjustment down
consensus.nPowMaxAdjustUp = 16; // 16% adjustment up
consensus.nPowTargetSpacing = 1 * 60;
consensus.nPreBlossomPowTargetSpacing = Consensus::PRE_BLOSSOM_POW_TARGET_SPACING;
consensus.nPostBlossomPowTargetSpacing = Consensus::POST_BLOSSOM_POW_TARGET_SPACING;
consensus.nPowAllowMinDifficultyBlocksAfterHeight = boost::none;
@ -145,7 +143,6 @@ public:
// (Zcash) vAlertPubKey = ParseHex("04b7ecf0baa90495ceb4e4090f6b2fd37eec1e9c85fac68a487f3ce11589692e4a317479316ee814e066638e1db54e37a10689b70286e6315b1087b6615d179264");
nDefaultPort = 7770;
nMinerThreads = 0;
nMaxTipAge = 24 * 60 * 60;
nPruneAfterHeight = 100000;
const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
@ -241,13 +238,41 @@ void *chainparams_commandline(void *ptr)
mainParams.pchMessageStart[3] = (ASSETCHAINS_MAGIC >> 24) & 0xff;
fprintf(stderr,">>>>>>>>>> %s: p2p.%u rpc.%u magic.%08x %u %lu coins\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT,ASSETCHAINS_MAGIC,ASSETCHAINS_MAGIC,ASSETCHAINS_SUPPLY / COIN);
bool isVerusActive = _IsVerusActive();
int64_t nBlockTime = isVerusActive ? DEFAULT_BLOCKTIME_TARGET : GetArg("-blocktime", DEFAULT_BLOCKTIME_TARGET);
mainParams.SetBlockTime(nBlockTime);
if (ASSETCHAINS_ALGO != ASSETCHAINS_EQUIHASH)
{
// this is only good for 60 second blocks with an averaging window of 45. for other parameters, use:
// nLwmaAjustedWeight = (N+1)/2 * (0.9989^(500/nPowAveragingWindow)) * nPowTargetSpacing
mainParams.consensus.nLwmaAjustedWeight = 1350;
mainParams.consensus.nPowAveragingWindow = 45;
// nLwmaAjustedWeight = (N+1)/2 * (0.9989^(500/nPowAveragingWindow)) * nPowTargetSpacing
int64_t PowAveragingWindow = isVerusActive ? DEFAULT_AVERAGING_WINDOW : GetArg("-averagingwindow", DEFAULT_AVERAGING_WINDOW);
mainParams.consensus.nPowAveragingWindow = PowAveragingWindow;
mainParams.consensus.powAlternate = uint256S("00000f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f");
if (!isVerusActive && mainParams.consensus.nBlockTime != DEFAULT_BLOCKTIME_TARGET)
{
cpp_dec_float_50 averagingFactor(std::to_string((mainParams.consensus.nPowAveragingWindow+1)/2));
cpp_dec_float_50 factorBase("0.9989");
cpp_dec_float_50 factorExponent = cpp_dec_float_50("500") / cpp_dec_float_50(std::to_string(mainParams.consensus.nPowAveragingWindow));
cpp_dec_float_50 blockTime(std::to_string(mainParams.consensus.nBlockTime));
cpp_dec_float_50 weight = averagingFactor * pow(factorBase, factorExponent) * blockTime;
std::stringstream ss(weight.str(0, std::ios_base::fmtflags::_S_fixed));
try
{
ss >> mainParams.consensus.nLwmaAjustedWeight;
}
catch(const std::exception& e)
{
fprintf(stderr,"%s: error calculating adjusted blocktime weight\n", __func__);
assert(false);
}
LogPrint("blocktime", "nLwmaAjustedWeight = %ld\n", mainParams.consensus.nLwmaAjustedWeight);
} else {
mainParams.consensus.nLwmaAjustedWeight = 1350;
}
}
if (ASSETCHAINS_LWMAPOS != 0)
@ -263,7 +288,7 @@ void *chainparams_commandline(void *ptr)
}
// this includes VRSCTEST, unlike the checkpoints and changes below
if (_IsVerusActive())
if (isVerusActive)
{
mainParams.consensus.fCoinbaseMustBeProtected = true;
}
@ -780,6 +805,14 @@ bool AreParamsInitialized()
return (pCurrentParams != NULL);
}
void CChainParams::SetBlockTime(uint64_t blockTime)
{
consensus.nBlockTime = blockTime;
consensus.nMaxFutureBlockTime = 7 * consensus.nBlockTime;
consensus.nPowTargetSpacing = consensus.nBlockTime;
nMaxTipAge = 24 * 60 * consensus.nBlockTime;
}
CChainParams &Params(CBaseChainParams::Network network) {
switch (network) {
case CBaseChainParams::MAIN:

2
src/chainparams.h

@ -125,6 +125,8 @@ public:
CMessageHeader::MessageStartChars pchMessageStart; // jl777 moved
Consensus::Params consensus;
void SetBlockTime(uint64_t blockTime);
protected:
CChainParams() {}

1
src/consensus/params.h

@ -124,6 +124,7 @@ struct Params {
int64_t nPowMaxAdjustDown;
int64_t nPowMaxAdjustUp;
int64_t nPowTargetSpacing;
int64_t nBlockTime;
int64_t nLwmaAjustedWeight;
/* Proof of stake parameters */

2
src/deprecation.h

@ -9,7 +9,7 @@
// * Shut down 20 weeks' worth of blocks after the estimated release block height.
// * A warning is shown during the 2 weeks' worth of blocks prior to shut down.
static const int APPROX_RELEASE_HEIGHT = 2203000;
static const int APPROX_RELEASE_HEIGHT = 2212000;
static const int WEEKS_UNTIL_DEPRECATION = 20;
static const int DEPRECATION_HEIGHT = APPROX_RELEASE_HEIGHT + (WEEKS_UNTIL_DEPRECATION * 7 * 60 * 24);

6
src/init.cpp

@ -515,6 +515,8 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-miningdistribution={\"addressorid\":<n>,...}", _("destination addresses and relative amounts used as ratios to divide total rewards + fees"));
strUsage += HelpMessageOpt("-miningdistributionpassthrough", _("uses the same miningdistribution values and addresses/IDs as Verus when merge mining"));
strUsage += HelpMessageOpt("-chain=pbaaschainname", _("loads either mainnet or resolves and loads a PBaaS chain if not vrsc or vrsctest"));
strUsage += HelpMessageOpt("-blocktime=<n>", strprintf(_("Set target block time (in seconds) for difficulty adjustment (default: %d)"), DEFAULT_BLOCKTIME_TARGET));
strUsage += HelpMessageOpt("-averagingwindow=<n>", strprintf(_("Set averaging window for difficulty adjustment, in blocks (default: %d)"), DEFAULT_AVERAGING_WINDOW));
strUsage += HelpMessageOpt("-testnet", _("loads PBaaS network in testmode"));
strUsage += HelpMessageGroup(_("Node relay options:"));
@ -1265,10 +1267,10 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
}
// get default IDs and addresses
auto defaultIDDest = DecodeDestination(GetArg("-defaultid", ""));
VERUS_DEFAULTID = defaultIDDest.which() == COptCCParams::ADDRTYPE_ID ? CIdentityID(GetDestinationID(defaultIDDest)) : CIdentityID();
auto notaryIDDest = DecodeDestination(GetArg("-notaryid", ""));
VERUS_NOTARYID = notaryIDDest.which() == COptCCParams::ADDRTYPE_ID ? CIdentityID(GetDestinationID(notaryIDDest)) : CIdentityID();
auto defaultIDDest = DecodeDestination(GetArg("-defaultid", VERUS_NOTARYID.IsNull() ? "" : EncodeDestination(notaryIDDest)));
VERUS_DEFAULTID = defaultIDDest.which() == COptCCParams::ADDRTYPE_ID ? CIdentityID(GetDestinationID(defaultIDDest)) : CIdentityID();
auto nodeIDDest = DecodeDestination(GetArg("-nodeid", ""));
VERUS_NODEID = nodeIDDest.which() == COptCCParams::ADDRTYPE_ID ? GetDestinationID(nodeIDDest) : uint160();
VERUS_DEFAULT_ZADDR = GetArg("-cheatcatcher", "");

2
src/komodo_globals.h

@ -96,7 +96,7 @@ uint32_t ASSETCHAINS_STARTING_DIFF = 0;
// Verus proof of stake controls
int32_t ASSETCHAINS_LWMAPOS = 0; // percentage of blocks should be PoS
int32_t VERUS_BLOCK_POSUNITS = 1024; // one block is 1000 units
int32_t VERUS_MIN_STAKEAGE = 150; // 1/2 this should also be a cap on the POS averaging window, or startup could be too easy
int32_t VERUS_MIN_STAKEAGE = 150; // 2x this should also be a cap on the POS averaging window, or startup could be too easy
int32_t VERUS_CONSECUTIVE_POS_THRESHOLD = 7; // this gives us 9 in a row
int32_t VERUS_PBAAS_CONSECUTIVE_POS_THRESHOLD = 3; // reduce to max 5 in a row
int32_t VERUS_NOPOS_THRESHHOLD = 150; // if we have no POS blocks in this many blocks, reset difficulty

4
src/main.h

@ -58,6 +58,10 @@ struct CNodeStateStats;
#define DEFAULT_MEMPOOL_EXPIRY 1
#define _COINBASE_MATURITY 100
/** Default block time target for difficulty adjustment, in seconds **/
static const unsigned int DEFAULT_BLOCKTIME_TARGET = 60;
/** Default target spacing (blocks) for difficulty adjustment **/
static const unsigned int DEFAULT_AVERAGING_WINDOW = 45;
/** Default for -blockmaxsize and -blockminsize, which control the range of sizes the mining code will create **/
static const unsigned int DEFAULT_BLOCK_MAX_SIZE = MAX_BLOCK_SIZE;
static const unsigned int DEFAULT_BLOCK_MIN_SIZE = 0;

6
src/miner.cpp

@ -2075,13 +2075,17 @@ CBlockTemplate* CreateNewBlock(const CChainParams& chainparams, const std::vecto
CValidationState state;
CPBaaSNotarization earnedNotarization;
int numOuts = coinbaseTx.vout.size();
if (CPBaaSNotarization::CreateEarnedNotarization(ConnectedChains.FirstNotaryChain(),
DestinationToTransferDestination(proposer),
isStake,
state,
coinbaseTx.vout,
earnedNotarization))
earnedNotarization) &&
numOuts != coinbaseTx.vout.size() &&
LogAcceptCategory("notarization"))
{
LogPrintf("%s: entering earned notarization into block %u, notarization: %s\n", __func__, Mining_height, earnedNotarization.ToUniValue().write(1,2).c_str());
}
CPBaaSNotarization lastImportNotarization;
CUTXORef lastImportNotarizationUTXO;

2
src/pbaas/pbaas.cpp

@ -3780,7 +3780,7 @@ std::string CConnectedChains::GetFriendlyCurrencyName(const uint160 &currencyID)
std::string retName;
uint160 curID = currencyID;
CCurrencyDefinition curDef;
for (curDef = GetCachedCurrency(curID); curDef.IsValid(); curDef = GetCachedCurrency(curID))
for (curDef = GetCachedCurrency(curID); curDef.IsValid(); curDef = curID.IsNull() ? CCurrencyDefinition() : GetCachedCurrency(curID))
{
if (curDef.parent.IsNull())
{

1
src/rpc/client.cpp

@ -1710,6 +1710,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "makeoffer", 1},
{ "takeoffer", 1},
{ "closeoffers", 0},
{ "getvdxfid", 1},
// Zcash addition
{ "z_setmigration", 0},
};

32
src/rpc/misc.cpp

@ -1585,8 +1585,8 @@ bool timestampSort(std::pair<CMempoolAddressDeltaKey, CMempoolAddressDelta> a,
}
void CurrencyValuesAndNames(UniValue &output, bool spending, const CScript script, CAmount satoshis, bool friendlyNames=false);
void CurrencyValuesAndNames(UniValue &output, bool spending, const CScript script, CAmount satoshis, bool friendlyNames)
void CurrencyValuesAndNames(UniValue &output, bool spending, const CScript &script, CAmount satoshis, bool friendlyNames=false);
void CurrencyValuesAndNames(UniValue &output, bool spending, const CScript &script, CAmount satoshis, bool friendlyNames)
{
if (CConstVerusSolutionVector::GetVersionByHeight(chainActive.Height()) >= CActivationHeight::ACTIVATE_PBAAS)
{
@ -1609,7 +1609,7 @@ void CurrencyValuesAndNames(UniValue &output, bool spending, const CScript scrip
currencyBal.push_back(make_pair(name, ValueFromAmount(oneBalance.second)));
if (friendlyNames)
{
currencyNames.push_back(make_pair(name, ConnectedChains.GetFriendlyCurrencyName(oneBalance.first)));
currencyNames.pushKV(name, ConnectedChains.GetFriendlyCurrencyName(oneBalance.first));
}
}
output.pushKV("currencyvalues", currencyBal);
@ -1639,7 +1639,14 @@ void CurrencyValuesAndNames(UniValue &output, bool spending, const CTransaction
}
else
{
script = tx.vout[index].scriptPubKey;
if (tx.vout.size() > index && index >= 0)
{
script = tx.vout[index].scriptPubKey;
}
else
{
throw JSONRPCError(RPC_DATABASE_ERROR, "Unable to retrieve data to for currency output values");
}
}
return CurrencyValuesAndNames(output, spending, script, satoshis, friendlyNames);
}
@ -1672,7 +1679,10 @@ UniValue AddressMemPoolUni(const std::vector<std::pair<uint160, int>> &addresses
delta.push_back(Pair("index", (int)it->first.index));
delta.push_back(Pair("satoshis", it->second.amount));
delta.push_back(Pair("spending", (bool)it->first.spending));
CurrencyValuesAndNames(delta, it->first.spending, curTx, it->first.index, it->second.amount, friendlyNames);
if (!it->first.txhash.IsNull() && it->first.txhash == curTx.GetHash() || mempool.lookup(it->first.txhash, curTx))
{
CurrencyValuesAndNames(delta, it->first.spending, curTx, it->first.index, it->second.amount, friendlyNames);
}
delta.push_back(Pair("timestamp", it->second.time));
if (it->second.amount < 0) {
delta.push_back(Pair("prevtxid", it->second.prevhash.GetHex()));
@ -1795,7 +1805,8 @@ UniValue getaddressutxos(const UniValue& params, bool fHelp)
std::string address = "";
if (it->second.script.IsPayToCryptoCondition())
COptCCParams p;
if (it->second.script.IsPayToCryptoCondition(p) && p.IsValid())
{
txnouttype outType;
std::vector<CTxDestination> addresses;
@ -1826,7 +1837,10 @@ UniValue getaddressutxos(const UniValue& params, bool fHelp)
output.push_back(Pair("txid", it->first.txhash.GetHex()));
output.push_back(Pair("outputIndex", (int)it->first.index));
output.push_back(Pair("script", HexStr(it->second.script.begin(), it->second.script.end())));
CurrencyValuesAndNames(output, false, it->second.script, it->second.satoshis, friendlyNames);
if (p.IsValid())
{
CurrencyValuesAndNames(output, false, it->second.script, it->second.satoshis, friendlyNames);
}
output.push_back(Pair("satoshis", it->second.satoshis));
output.push_back(Pair("height", it->second.blockHeight));
if (chainActive.Height() >= it->second.blockHeight)
@ -1953,7 +1967,7 @@ UniValue getaddressdeltas(const UniValue& params, bool fHelp)
}
uint256 blockHash;
if (verbosity && (it->first.txhash == curTx.GetHash() || myGetTransaction(it->first.txhash, curTx, blockHash)))
if (verbosity && !it->first.txhash.IsNull() && (it->first.txhash == curTx.GetHash() || myGetTransaction(it->first.txhash, curTx, blockHash)))
{
CurrencyValuesAndNames(delta, it->first.spending, curTx, it->first.index, it->second, friendlyNames);
}
@ -2045,7 +2059,7 @@ UniValue getaddressbalance(const UniValue& params, bool fHelp)
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++) {
uint256 blockHash;
if (it->first.txhash == curTx.GetHash() || myGetTransaction(it->first.txhash, curTx, blockHash))
if (!it->first.txhash.IsNull() && (it->first.txhash == curTx.GetHash() || myGetTransaction(it->first.txhash, curTx, blockHash)))
{
if (it->first.spending) {
CTransaction priorOutTx;

2
src/rpc/pbaasrpc.cpp

@ -9739,7 +9739,7 @@ UniValue registernamecommitment(const UniValue& params, bool fHelp)
if (!success)
{
throw JSONRPCError(RPC_INVALID_PARAMETER, "Insufficient funds for identity registration");
throw JSONRPCError(RPC_INVALID_PARAMETER, "Insufficient funds for identity commitment registration");
}
// aggregate all inputs into one output with only the offer coins and offer indexes

2
src/rpc/server.cpp

@ -729,6 +729,8 @@ UniValue CRPCTable::execute(const std::string &strMethod, const UniValue &params
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method " + strMethod + " not found");
}
LogPrint("rpcrequests", "command %s, params:\n%s\n", strMethod.c_str(), params.write(1,2).c_str());
g_rpcSignals.PreCommand(*pcmd);
try

2
src/version.h

@ -35,6 +35,6 @@ static const int MEMPOOL_GD_VERSION = 60002;
static const int NO_BLOOM_VERSION = 170004;
#define KOMODO_VERSION "0.2.1"
#define VERUS_VERSION "0.9.4-4"
#define VERUS_VERSION "0.9.4-5"
#endif // BITCOIN_VERSION_H

Loading…
Cancel
Save