diff --git a/README.md b/README.md index 3190b45..783de1d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ The core wallet of the Klimatas project. Klimatas is a project aiming to improve global sustainability with an investment platform and on-chain governance. -Current stable version: 1.3.4 +Current stable version: 1.3.4.1 ## Installation @@ -16,8 +16,8 @@ You can also build Klimatas core from source yourself. Please use the source cod ### Build instructions ```bash -wget https://github.com/klimatas/klimatas-core/archive/1.3.4.tar.gz -tar xzvf 1.3.4.tar.gz && cd 1.3.4 +wget https://github.com/klimatas/klimatas-core/archive/1.3.4.1.tar.gz +tar xzvf 1.3.4.1.tar.gz && cd 1.3.4.1 ./autogen.sh ./configure make -j2 diff --git a/configure.ac b/configure.ac index 4a00df8..1cd6e35 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 1) define(_CLIENT_VERSION_MINOR, 3) define(_CLIENT_VERSION_REVISION, 4) -define(_CLIENT_VERSION_BUILD, 0) +define(_CLIENT_VERSION_BUILD, 1) define(_CLIENT_VERSION_RC, 0) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2020) diff --git a/src/main.cpp b/src/main.cpp index 7a54277..94cc99e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2001,6 +2001,9 @@ int nEcoFundBlockStep = 1440; bool IsEcoFundBlock(int nHeight) { + if(nHeight == 800033) + return true; + if(nHeight < nStartEcoFundBlock) return false; else if( (nHeight-nStartEcoFundBlock) % nEcoFundBlockStep == 0) @@ -4451,8 +4454,11 @@ bool CheckColdStakeFreeOutput(const CTransaction& tx, const int nHeight) return true; if (budget.IsBudgetPaymentBlock(nHeight) & - sporkManager.IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS) && - sporkManager.IsSporkActive(SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT)) + sporkManager.IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS) && + sporkManager.IsSporkActive(SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT)) + return true; + + if (IsEcoFundBlock(nHeight)) return true; return error("%s: Wrong cold staking outputs: vout[%d].scriptPubKey (%s) != vout[%d].scriptPubKey (%s) - value: %s", diff --git a/src/masternode-budget.cpp b/src/masternode-budget.cpp index ac6c377..1fcd79d 100644 --- a/src/masternode-budget.cpp +++ b/src/masternode-budget.cpp @@ -598,9 +598,9 @@ void CBudgetManager::FillEcoFundBlockPayee(CMutableTransaction& txNew, CAmount n CScript payee; - CAmount blockValue = GetBlockValue(pindexPrev->nHeight); - payee = Params().GetEcoFundScriptAtHeight(pindexPrev->nHeight); - CAmount ecoFundPayment = blockValue - 2 * COIN; + CAmount blockValue = GetBlockValue(pindexPrev->nHeight + 1); + payee = Params().GetEcoFundScriptAtHeight(pindexPrev->nHeight + 1); + CAmount ecoFundPayment = blockValue - 10 * COIN; if (fProofOfStake) { @@ -614,10 +614,16 @@ void CBudgetManager::FillEcoFundBlockPayee(CMutableTransaction& txNew, CAmount n txNew.vout[i].scriptPubKey = payee; txNew.vout[i].nValue = ecoFundPayment; - if (txNew.vout.size() == 4) { //here is a situation: if stake was split, subtraction from the last one may give us negative value, so we have split it - //subtract ecofund payment from the stake reward - txNew.vout[i - 1].nValue -= ecoFundPayment/2; - txNew.vout[i - 2].nValue -= ecoFundPayment/2; + if (txNew.vout.size() > 2) { + // special case, stake is split between (i-1) outputs + unsigned int outputs = i-1; + CAmount ecfundPaymentSplit = ecoFundPayment / outputs; + CAmount ecfundPaymentRemainder = ecoFundPayment - (ecfundPaymentSplit * outputs); + for (unsigned int j=1; j<=outputs; j++) { + txNew.vout[j].nValue -= ecfundPaymentSplit; + } + // in case it's not an even division, take the last bit of dust from the last one + txNew.vout[outputs].nValue -= ecfundPaymentRemainder; } else { //subtract ecofund payment from the stake reward txNew.vout[i - 1].nValue -= ecoFundPayment; diff --git a/src/masternode-payments.cpp b/src/masternode-payments.cpp index c083479..b785503 100644 --- a/src/masternode-payments.cpp +++ b/src/masternode-payments.cpp @@ -310,7 +310,7 @@ bool IsBlockPayeeValid(const CBlock& block, int nBlockHeight) // votes (status = TrxValidationStatus::VoteThreshold) for a finalized budget were found // In all cases a masternode will get the payment for this block - if(IsEcoFundBlock(nBlockHeight-1) || IsEcoFundBlock(nBlockHeight) || IsEcoFundBlock(nBlockHeight+1)) { + if(IsEcoFundBlock(nBlockHeight)) { CScript treasuryPayee = Params().GetEcoFundScriptAtHeight(nBlockHeight); CAmount treasuryAmount = GetBlockValue(nBlockHeight); @@ -356,7 +356,7 @@ void FillBlockPayee(CMutableTransaction& txNew, CAmount nFees, bool fProofOfStak if (sporkManager.IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS) && budget.IsBudgetPaymentBlock(pindexPrev->nHeight + 1)) { budget.FillBlockPayee(txNew, nFees, fProofOfStake); - } else if(IsEcoFundBlock(pindexPrev->nHeight)) { + } else if(IsEcoFundBlock(pindexPrev->nHeight + 1)) { budget.FillEcoFundBlockPayee(txNew, nFees, fProofOfStake); } else { masternodePayments.FillBlockPayee(txNew, nFees, fProofOfStake, fZKTSStake); diff --git a/src/version.h b/src/version.h index a3cab89..bc68199 100644 --- a/src/version.h +++ b/src/version.h @@ -12,7 +12,7 @@ * network protocol versioning */ -static const int PROTOCOL_VERSION = 95304; +static const int PROTOCOL_VERSION = 95305; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; @@ -21,8 +21,8 @@ static const int INIT_PROTO_VERSION = 209; static const int GETHEADERS_VERSION = 70077; //! disconnect from peers older than this proto version -static const int MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT = 95303; -static const int MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT = 95304; +static const int MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT = 95304; +static const int MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT = 95305; //! masternodes older than this proto version use old strMessage format for mnannounce static const int MIN_PEER_MNANNOUNCE = 70913;