From 1b28de2f2cd4653dc82215807f1f7c3198efadc1 Mon Sep 17 00:00:00 2001 From: ThatGuy Date: Wed, 13 May 2020 11:25:26 -0400 Subject: [PATCH] 1.2.0.0 (#1) * Remove Old Dev code / Collat Fork * Remove spork 17 --- configure.ac | 2 +- contrib/gitian-descriptors/gitian-aarch64.yml | 2 +- contrib/gitian-descriptors/gitian-linux.yml | 2 +- contrib/gitian-descriptors/gitian-osx.yml | 2 +- contrib/gitian-descriptors/gitian-rpi2.yml | 2 +- contrib/gitian-descriptors/gitian-win.yml | 2 +- src/activemasternode.cpp | 4 +- src/chainparams.cpp | 20 +------- src/chainparams.h | 8 +-- src/clientversion.h | 2 +- src/main.cpp | 44 ++++++---------- src/main.h | 4 +- src/masternode-budget.cpp | 50 ------------------- src/masternode-budget.h | 1 - src/masternode-payments.cpp | 50 +------------------ src/masternode.cpp | 4 +- src/masternodeman.cpp | 2 +- src/obfuscation.cpp | 3 +- src/spork.cpp | 3 -- src/spork.h | 4 +- src/version.h | 9 ++-- src/wallet.cpp | 14 ++---- 22 files changed, 47 insertions(+), 187 deletions(-) diff --git a/configure.ac b/configure.ac index 961d580..f53295e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 1) -define(_CLIENT_VERSION_MINOR, 1) +define(_CLIENT_VERSION_MINOR, 2) define(_CLIENT_VERSION_REVISION, 0) define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_IS_RELEASE, true) diff --git a/contrib/gitian-descriptors/gitian-aarch64.yml b/contrib/gitian-descriptors/gitian-aarch64.yml index 7023b41..069c1ae 100644 --- a/contrib/gitian-descriptors/gitian-aarch64.yml +++ b/contrib/gitian-descriptors/gitian-aarch64.yml @@ -1,5 +1,5 @@ --- -name: "xavander-aarch64-1.1.0.0" +name: "xavander-aarch64-1.2.0.0" enable_cache: true suites: - "trusty" diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index e171cf8..a8439d7 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -1,5 +1,5 @@ --- -name: "xavander-linux-1.1.0.0" +name: "xavander-linux-1.2.0.0" enable_cache: true suites: - "trusty" diff --git a/contrib/gitian-descriptors/gitian-osx.yml b/contrib/gitian-descriptors/gitian-osx.yml index a941d59..e989f55 100644 --- a/contrib/gitian-descriptors/gitian-osx.yml +++ b/contrib/gitian-descriptors/gitian-osx.yml @@ -1,5 +1,5 @@ --- -name: "xavander-osx-1.1.0.0" +name: "xavander-osx-1.2.0.0" enable_cache: true suites: - "trusty" diff --git a/contrib/gitian-descriptors/gitian-rpi2.yml b/contrib/gitian-descriptors/gitian-rpi2.yml index 33146a2..ac6db38 100644 --- a/contrib/gitian-descriptors/gitian-rpi2.yml +++ b/contrib/gitian-descriptors/gitian-rpi2.yml @@ -1,5 +1,5 @@ --- -name: "xavander-rpi2-1.1.0.0" +name: "xavander-rpi2-1.2.0.0" enable_cache: true suites: - "trusty" diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml index fe43e51..c0bc08d 100644 --- a/contrib/gitian-descriptors/gitian-win.yml +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -1,5 +1,5 @@ --- -name: "xavander-win-1.1.0.0" +name: "xavander-win-1.2.0.0" enable_cache: true suites: - "trusty" diff --git a/src/activemasternode.cpp b/src/activemasternode.cpp index d589d1f..e0307bb 100644 --- a/src/activemasternode.cpp +++ b/src/activemasternode.cpp @@ -10,6 +10,7 @@ #include "masternodeman.h" #include "protocol.h" #include "spork.h" +#include "main.h" // // Bootup the Masternode, look for a 10000 XAVANDER input and register on the network @@ -472,8 +473,7 @@ vector CActiveMasternode::SelectCoinsMasternode() // Filter BOOST_FOREACH (const COutput& out, vCoins) { - if (out.tx->vout[out.i].nValue == Params().MasternodeCollateralAmt() * COIN) { //Was 5000 * COIN - //if (out.tx->vout[out.i].nValue == 10000 * COIN){ + if (out.tx->vout[out.i].nValue == GetCurrentCollateral() * COIN) { filteredCoins.push_back(out); } } diff --git a/src/chainparams.cpp b/src/chainparams.cpp index ed7fff3..e1a5771 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -102,7 +102,6 @@ class CMainParams : public CChainParams CMainParams() { networkID = CBaseChainParams::MAIN; - vTreasuryRewardAddress = ""; //Fill in address once wallet generated or when dev fee is activated (TFinch) strNetworkID = "main"; /** * The message start string is designed to be unlikely to occur in normal data. @@ -126,7 +125,8 @@ class CMainParams : public CChainParams nTargetSpacing = 1 * 60; // Xavander: 1 minutes nMaturity = 10; // 10 Conf to mature coins nMasternodeCountDrift = 20; - nMasternodeCollateralAmt = 10000; //masternode collateral + nMasternodeCollateralAmt = 10000; + nMasternodeCollateralAmtNew = 50000; nMaxMoneyOut = 55000000 * COIN; /** Height or Time Based Activations **/ @@ -226,22 +226,6 @@ class CMainParams : public CChainParams } }; - std::string CChainParams::GetTreasuryRewardAddressAtHeight(int nHeight) const -{ - return vTreasuryRewardAddress; - -} - - CScript CChainParams::GetTreasuryRewardScriptAtHeight(int nHeight) const -{ - CBitcoinAddress address(GetTreasuryRewardAddressAtHeight(nHeight).c_str()); - assert(address.IsValid()); - CScript script = GetScriptForDestination(address.Get()); - return script; - -} - - static CMainParams mainParams; diff --git a/src/chainparams.h b/src/chainparams.h index d4caa22..b66d867 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -124,12 +124,7 @@ class CChainParams //Central Collateral Amount int MasternodeCollateralAmt() const { return nMasternodeCollateralAmt; } - - //Treasury Code - std::string vTreasuryRewardAddress; - - std::string GetTreasuryRewardAddressAtHeight(int height) const; - CScript GetTreasuryRewardScriptAtHeight(int height) const; + int MasternodeCollateralAmtNew() const { return nMasternodeCollateralAmtNew; } protected: CChainParams() {} @@ -140,6 +135,7 @@ class CChainParams std::vector vAlertPubKey; int nDefaultPort; int nMasternodeCollateralAmt; + int nMasternodeCollateralAmtNew; uint256 bnProofOfWorkLimit; int nMaxReorganizationDepth; int nSubsidyHalvingInterval; diff --git a/src/clientversion.h b/src/clientversion.h index 23734f9..a93477e 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -16,7 +16,7 @@ //! These need to be macros, as clientversion.cpp's and xavander*-res.rc's voodoo requires it #define CLIENT_VERSION_MAJOR 1 -#define CLIENT_VERSION_MINOR 1 +#define CLIENT_VERSION_MINOR 2 #define CLIENT_VERSION_REVISION 0 #define CLIENT_VERSION_BUILD 0 diff --git a/src/main.cpp b/src/main.cpp index f7779ef..5152577 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2103,6 +2103,13 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex) return true; } +CAmount GetCurrentCollateral() +{ + if (ActiveProtocol() >= COLLATERAL_FORK_VERSION && chainActive.Height() >= COLLATERAL_FORK_BLOCK) + return Params().MasternodeCollateralAmtNew(); + else + return Params().MasternodeCollateralAmt(); +} double ConvertBitsToDouble(unsigned int nBits) { @@ -2138,11 +2145,6 @@ int64_t GetBlockValue(int nHeight) } } - if (IsTreasuryBlock(nHeight)) { - LogPrintf("GetBlockValue(): this is a treasury block\n"); - nSubsidy = GetTreasuryAward(nHeight); - - }else { if (nHeight == 0) { nSubsidy = 2500000 * COIN; }else if (nHeight <= 200 && nHeight > 1) { @@ -2167,15 +2169,17 @@ int64_t GetBlockValue(int nHeight) nSubsidy = 1.5 * COIN; }else if (nHeight <= 306510 && nHeight > 205600) { nSubsidy = 1.5 * COIN; - }else { + } else if (nHeight <= 1000000 && nHeight > 306510) { nSubsidy = 1 * COIN; + } else { + nSubsidy = 7 * COIN; } int64_t nMoneySupply = chainActive.Tip()->nMoneySupply; if (nMoneySupply + nSubsidy >= Params().MaxMoneyOut()) nSubsidy = Params().MaxMoneyOut() - nMoneySupply; if (nMoneySupply >= Params().MaxMoneyOut()) nSubsidy = 0; - } + return nSubsidy; } @@ -2187,30 +2191,12 @@ int64_t GetMasternodePayment(int nHeight, int64_t blockValue, int nMasternodeCou ret = blockValue * 0; }else if (nHeight < 200 && nHeight > 1) { ret = blockValue * 0; - }else if (nHeight > 200) { + }else if (nHeight > 200 && nHeight <= 1000000) { ret = blockValue / 10 * 9; - }return ret; -} - -//Make sure Treasury is set to max and able to be used at later date if wanted to be -int nStartTreasuryBlock = INT_MAX; -int nTreasuryBlockStep = INT_MAX; -//Checks to see if block count above is correct if not then no Treasury -bool IsTreasuryBlock(int nHeight) -{ - if (nHeight < nStartTreasuryBlock) - return false; - else if ((nHeight - nStartTreasuryBlock) % nTreasuryBlockStep == 0) - return true; - else - return false; -} - -int64_t GetTreasuryAward(int nHeight) -{ - if (IsTreasuryBlock(nHeight)) { - return 0; + } else if (nHeight > 1000000) { + ret = blockValue / 10 * 8.6; } + return ret; } bool IsInitialBlockDownload() diff --git a/src/main.h b/src/main.h index 7a89e25..ec4b404 100644 --- a/src/main.h +++ b/src/main.h @@ -236,6 +236,7 @@ bool GetTransaction(const uint256& hash, CTransaction& tx, uint256& hashBlock, b bool DisconnectBlocksAndReprocess(int blocks); // ***TODO*** +CAmount GetCurrentCollateral(); double ConvertBitsToDouble(unsigned int nBits); int64_t GetMasternodePayment(int nHeight, int64_t blockValue, int nMasternodeCount = 0); unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader* pblock, bool fProofOfStake); @@ -243,9 +244,6 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead bool ActivateBestChain(CValidationState& state, CBlock* pblock = NULL, bool fAlreadyChecked = false); CAmount GetBlockValue(int nHeight); -bool IsTreasuryBlock(int nHeight); -int64_t GetTreasuryAward(int nHeight); - /** Create a new block index entry for a given block hash */ CBlockIndex* InsertBlockIndex(uint256 hash); /** Abort with a message */ diff --git a/src/masternode-budget.cpp b/src/masternode-budget.cpp index 4420092..5231c25 100644 --- a/src/masternode-budget.cpp +++ b/src/masternode-budget.cpp @@ -553,56 +553,6 @@ void CBudgetManager::FillBlockPayee(CMutableTransaction& txNew, CAmount nFees, b } } - -void CBudgetManager::FillTreasuryBlockPayee(CMutableTransaction& txNew, CAmount nFees, bool fProofOfStake) -{ - CBlockIndex* pindexPrev = chainActive.Tip(); - if (!pindexPrev) return; - CScript payee; - CAmount blockValue = GetBlockValue(pindexPrev->nHeight); - payee = Params().GetTreasuryRewardScriptAtHeight(pindexPrev->nHeight); - CAmount treasurePayment = blockValue - 10 * COIN; - if (fProofOfStake) - { - /**For Proof Of Stake vout[0] must be null - * Stake reward can be split into many different outputs, so we must - * use vout.size() to align with several different cases. - * An additional output is appended as the masternode payment - */ - unsigned int i = txNew.vout.size(); - txNew.vout.resize(i + 1); - txNew.vout[i].scriptPubKey = payee; - txNew.vout[i].nValue = treasurePayment; - 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 treasury payment from the stake reward - txNew.vout[i - 1].nValue -= treasurePayment / 2; - txNew.vout[i - 2].nValue -= treasurePayment / 2; - - } - else - { - //subtract treasury payment from the stake reward - txNew.vout[i - 1].nValue -= treasurePayment; - - } - - } - else - { - txNew.vout.resize(2); - txNew.vout[1].scriptPubKey = payee; - txNew.vout[1].nValue = treasurePayment; - txNew.vout[0].nValue = blockValue - treasurePayment; - - } - CTxDestination address1; - ExtractDestination(payee, address1); - CBitcoinAddress address2(address1); - -} - - CFinalizedBudget* CBudgetManager::FindFinalizedBudget(uint256 nHash) { if (mapFinalizedBudgets.count(nHash)) diff --git a/src/masternode-budget.h b/src/masternode-budget.h index 8ab2704..63782c7 100644 --- a/src/masternode-budget.h +++ b/src/masternode-budget.h @@ -236,7 +236,6 @@ class CBudgetManager bool IsTransactionValid(const CTransaction& txNew, int nBlockHeight); std::string GetRequiredPaymentsString(int nBlockHeight); void FillBlockPayee(CMutableTransaction& txNew, CAmount nFees, bool fProofOfStake); - void FillTreasuryBlockPayee(CMutableTransaction& txNew, CAmount nFees, bool fProofOfStake); void CheckOrphanVotes(); void Clear() diff --git a/src/masternode-payments.cpp b/src/masternode-payments.cpp index fc9e86a..96241ce 100644 --- a/src/masternode-payments.cpp +++ b/src/masternode-payments.cpp @@ -247,54 +247,13 @@ bool IsBlockPayeeValid(const CBlock& block, int nBlockHeight) } } - //check if it's valid treasury block - if (IsTreasuryBlock(nBlockHeight)) - { - CScript treasuryPayee = Params().GetTreasuryRewardScriptAtHeight(nBlockHeight); - CAmount treasuryAmount = GetTreasuryAward(nBlockHeight); - bool bFound = false; - BOOST_FOREACH (CTxOut out, txNew.vout) - { - if (out.nValue == treasuryAmount) - { - bFound = true; //correct treasury payment has been found - break; - - } - - } - if (!bFound) - { - LogPrint("masternode", "Invalid treasury payment detected %s\n", txNew.ToString().c_str()); - if (IsSporkActive(SPORK_17_TREASURY_PAYMENT_ENFORCEMENT)) - return false; - else - { - LogPrint("masternode", "SPORK_17_TREASURY_PAYMENT_ENFORCEMENT is not enabled, accept anyway\n"); - return true; - - } - - } - else - { - LogPrint("masternode", "Valid treasury payment detected %s\n", txNew.ToString().c_str()); - return true; - - } - - } - else - { - //check for masternode payee - if (masternodePayments.IsTransactionValid(txNew, nBlockHeight)) + //check for masternode payee + if (masternodePayments.IsTransactionValid(txNew, nBlockHeight)) return true; LogPrint("masternode", "Invalid mn payment detected %s\n", txNew.ToString().c_str()); if (IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT)) return false; LogPrint("masternode", "Masternode payment enforcement is disabled, accepting block\n"); - - } return true; } @@ -306,11 +265,6 @@ void FillBlockPayee(CMutableTransaction& txNew, int64_t nFees, bool fProofOfStak if (IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS) && budget.IsBudgetPaymentBlock(pindexPrev->nHeight + 1)) { budget.FillBlockPayee(txNew, nFees, fProofOfStake); - //} else { - } else if (IsTreasuryBlock(pindexPrev->nHeight)) { - //LogPrintf("FillBlockPayee(): It's time for treasury payment! Block %d\n",pindexPrev->nHeight + 1); - budget.FillTreasuryBlockPayee(txNew, nFees, fProofOfStake); - } else { masternodePayments.FillBlockPayee(txNew, nFees, fProofOfStake); } diff --git a/src/masternode.cpp b/src/masternode.cpp index ceb77b7..7b4e876 100644 --- a/src/masternode.cpp +++ b/src/masternode.cpp @@ -211,7 +211,7 @@ void CMasternode::Check(bool forceCheck) if (!unitTest) { CValidationState state; CMutableTransaction tx = CMutableTransaction(); - CTxOut vout = CTxOut(9999.99 * COIN, obfuScationPool.collateralPubKey); + CTxOut vout = CTxOut((GetCurrentCollateral() - 0.01) * COIN, obfuScationPool.collateralPubKey); tx.vin.push_back(vin); tx.vout.push_back(vout); @@ -571,7 +571,7 @@ bool CMasternodeBroadcast::CheckInputsAndAdd(int& nDoS) CValidationState state; CMutableTransaction tx = CMutableTransaction(); - CTxOut vout = CTxOut(9999.99 * COIN, obfuScationPool.collateralPubKey); + CTxOut vout = CTxOut((GetCurrentCollateral() - 0.01) * COIN, obfuScationPool.collateralPubKey); tx.vin.push_back(vin); tx.vout.push_back(vout); diff --git a/src/masternodeman.cpp b/src/masternodeman.cpp index 677db89..88bbc75 100644 --- a/src/masternodeman.cpp +++ b/src/masternodeman.cpp @@ -986,7 +986,7 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData CValidationState state; CMutableTransaction tx = CMutableTransaction(); - CTxOut vout = CTxOut(9999.99 * COIN, obfuScationPool.collateralPubKey); + CTxOut vout = CTxOut((GetCurrentCollateral() - 0.01) * COIN, obfuScationPool.collateralPubKey); tx.vin.push_back(vin); tx.vout.push_back(vout); diff --git a/src/obfuscation.cpp b/src/obfuscation.cpp index e9edbc9..0af43a0 100644 --- a/src/obfuscation.cpp +++ b/src/obfuscation.cpp @@ -2111,8 +2111,7 @@ bool CObfuScationSigner::IsVinAssociatedWithPubkey(CTxIn& vin, CPubKey& pubkey) uint256 hash; if (GetTransaction(vin.prevout.hash, txVin, hash, true)) { BOOST_FOREACH (CTxOut out, txVin.vout) { - if (out.nValue == Params().MasternodeCollateralAmt() * COIN) { // Was 20000 - //if (out.nValue == 10000 * COIN) { // Was 20000 + if (out.nValue == GetCurrentCollateral() * COIN) { if (out.scriptPubKey == payee2) return true; } } diff --git a/src/spork.cpp b/src/spork.cpp index 052f496..e152bef 100644 --- a/src/spork.cpp +++ b/src/spork.cpp @@ -138,7 +138,6 @@ int64_t GetSporkValue(int nSporkID) if (nSporkID == SPORK_14_NEW_PROTOCOL_ENFORCEMENT) r = SPORK_14_NEW_PROTOCOL_ENFORCEMENT_DEFAULT; if (nSporkID == SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2) r = SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2_DEFAULT; if (nSporkID == SPORK_16_ZEROCOIN_MAINTENANCE_MODE) r = SPORK_16_ZEROCOIN_MAINTENANCE_MODE_DEFAULT; - if (nSporkID == SPORK_17_TREASURY_PAYMENT_ENFORCEMENT) r = SPORK_17_TREASURY_PAYMENT_ENFORCEMENT_DEFAULT; if (r == -1) LogPrintf("GetSpork::Unknown Spork %d\n", nSporkID); } @@ -293,7 +292,6 @@ int CSporkManager::GetSporkIDByName(std::string strName) if (strName == "SPORK_14_NEW_PROTOCOL_ENFORCEMENT") return SPORK_14_NEW_PROTOCOL_ENFORCEMENT; if (strName == "SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2") return SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2; if (strName == "SPORK_16_ZEROCOIN_MAINTENANCE_MODE") return SPORK_16_ZEROCOIN_MAINTENANCE_MODE; - if (strName == "SPORK_17_TREASURY_PAYMENT_ENFORCEMENT") return SPORK_17_TREASURY_PAYMENT_ENFORCEMENT; return -1; } @@ -312,7 +310,6 @@ std::string CSporkManager::GetSporkNameByID(int id) if (id == SPORK_14_NEW_PROTOCOL_ENFORCEMENT) return "SPORK_14_NEW_PROTOCOL_ENFORCEMENT"; if (id == SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2) return "SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2"; if (id == SPORK_16_ZEROCOIN_MAINTENANCE_MODE) return "SPORK_16_ZEROCOIN_MAINTENANCE_MODE"; - if (id == SPORK_17_TREASURY_PAYMENT_ENFORCEMENT) return "SPORK_17_TREASURY_PAYMENT_ENFORCEMENT"; return "Unknown"; } diff --git a/src/spork.h b/src/spork.h index 337c4e1..1a394d8 100644 --- a/src/spork.h +++ b/src/spork.h @@ -27,7 +27,7 @@ using namespace boost; Sporks 11,12, and 16 to be removed with 1st zerocoin release */ #define SPORK_START 10001 -#define SPORK_END 10017 +#define SPORK_END 10015 #define SPORK_2_SWIFTTX 10001 #define SPORK_3_SWIFTTX_BLOCK_FILTERING 10002 @@ -42,7 +42,6 @@ using namespace boost; #define SPORK_14_NEW_PROTOCOL_ENFORCEMENT 10013 #define SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2 10014 #define SPORK_16_ZEROCOIN_MAINTENANCE_MODE 10015 -#define SPORK_17_TREASURY_PAYMENT_ENFORCEMENT 10016 #define SPORK_2_SWIFTTX_DEFAULT 978307200 //2001-1-1 #define SPORK_3_SWIFTTX_BLOCK_FILTERING_DEFAULT 1424217600 //2015-2-18 @@ -56,7 +55,6 @@ using namespace boost; #define SPORK_14_NEW_PROTOCOL_ENFORCEMENT_DEFAULT 4070908800 //OFF #define SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2_DEFAULT 4070908800 //OFF #define SPORK_16_ZEROCOIN_MAINTENANCE_MODE_DEFAULT 4070908800 //OFF -#define SPORK_17_TREASURY_PAYMENT_ENFORCEMENT_DEFAULT 0 // 9/3/2018 Turned on by TFinch class CSporkMessage; class CSporkManager; diff --git a/src/version.h b/src/version.h index f39508b..d2ece74 100644 --- a/src/version.h +++ b/src/version.h @@ -12,7 +12,7 @@ * network protocol versioning */ -static const int PROTOCOL_VERSION = 70004; +static const int PROTOCOL_VERSION = 70005; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; @@ -21,8 +21,11 @@ static const int INIT_PROTO_VERSION = 209; static const int GETHEADERS_VERSION = 70000; //! disconnect from peers older than this proto version -static const int MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT = 70002; -static const int MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT = 70004; +static const int MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT = 70004; +static const int MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT = 70005; + +static const int COLLATERAL_FORK_VERSION = 70005; +static const int COLLATERAL_FORK_BLOCK = 1000000; //! nTime field added to CAddress, starting with this version; //! if possible, avoid requesting addresses nodes older than this diff --git a/src/wallet.cpp b/src/wallet.cpp index 7b263b6..340b802 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1625,17 +1625,14 @@ void CWallet::AvailableCoins(vector& vCoins, bool fOnlyConfirmed, const if (nCoinType == ONLY_DENOMINATED) { found = IsDenominatedAmount(pcoin->vout[i].nValue); } else if (nCoinType == ONLY_NOT10000IFMN) { - found = !(fMasterNode && pcoin->vout[i].nValue == Params().MasternodeCollateralAmt() * COIN); - //found = !(fMasterNode && pcoin->vout[i].nValue == 10000 * COIN); + found = !(fMasterNode && pcoin->vout[i].nValue == GetCurrentCollateral() * COIN); } else if (nCoinType == ONLY_NONDENOMINATED_NOT10000IFMN) { if (IsCollateralAmount(pcoin->vout[i].nValue)) continue; // do not use collateral amounts found = !IsDenominatedAmount(pcoin->vout[i].nValue); - if (found && fMasterNode) found = pcoin->vout[i].nValue != Params().MasternodeCollateralAmt() * COIN; // do not use Hot MN funds - //if (found && fMasterNode) found = pcoin->vout[i].nValue != 10000 * COIN; // do not use Hot MN funds + if (found && fMasterNode) found = pcoin->vout[i].nValue != GetCurrentCollateral() * COIN; // do not use Hot MN funds } else if (nCoinType == ONLY_10000) { - found = pcoin->vout[i].nValue == Params().MasternodeCollateralAmt() * COIN; - //found = pcoin->vout[i].nValue == 10000 * COIN; - } else { + found = pcoin->vout[i].nValue == GetCurrentCollateral() * COIN; + } else { found = true; } if (!found) continue; @@ -2099,8 +2096,7 @@ bool CWallet::SelectCoinsDark(CAmount nValueMin, CAmount nValueMax, std::vector< if (out.tx->vout[out.i].nValue < CENT) continue; //do not allow collaterals to be selected if (IsCollateralAmount(out.tx->vout[out.i].nValue)) continue; - if (fMasterNode && out.tx->vout[out.i].nValue == Params().MasternodeCollateralAmt() * COIN) continue; - //if (fMasterNode && out.tx->vout[out.i].nValue == 10000 * COIN) continue; //masternode input + if (fMasterNode && out.tx->vout[out.i].nValue == GetCurrentCollateral() * COIN) continue; if (nValueRet + out.tx->vout[out.i].nValue <= nValueMax) { CTxIn vin = CTxIn(out.tx->GetHash(), out.i);