Skip to content

Commit

Permalink
v2.1 update && Update Masternode Collateral 3k - 10k Gradually
Browse files Browse the repository at this point in the history
  • Loading branch information
worldcryptoforum committed Jan 4, 2019
1 parent 1a80058 commit de5da6c
Show file tree
Hide file tree
Showing 16 changed files with 167 additions and 56 deletions.
2 changes: 1 addition & 1 deletion configure.ac
@@ -1,6 +1,6 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 1)
define(_CLIENT_VERSION_MAJOR, 2)
define(_CLIENT_VERSION_MINOR, 1)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 0)
Expand Down
4 changes: 2 additions & 2 deletions src/activemasternode.cpp
Expand Up @@ -402,7 +402,7 @@ vector<COutput> CActiveMasternode::SelectCoinsMasternode()

// Filter
BOOST_FOREACH (const COutput& out, vCoins) {
if (out.tx->vout[out.i].nValue == Params().MasternodeColleteralLimxDev() * COIN) { //exactly
if (out.tx->vout[out.i].nValue == MasternodeColleteralLimxDev(chainActive.Height()) * COIN) { //exactly
filteredCoins.push_back(out);
}
}
Expand Down Expand Up @@ -439,7 +439,7 @@ bool CMasternodeSigner::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().MasternodeColleteralLimxDev() * COIN) {
if (out.nValue == MasternodeColleteralLimxDev(chainActive.Height()) * COIN) {
if (out.scriptPubKey == payee2) return true;
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/chainparams.cpp
Expand Up @@ -118,12 +118,10 @@ class CMainParams : public CChainParams
nMinerThreads = 0;
nTargetTimespan = 1 * 60;
nTargetSpacing = 1 * 60;
nLastPOWBlock = 300;
nMaturity = 120;
nMasternodeCountDrift = 20;
nMasternodeColleteralLimxDev = 1000;
nModifierUpdateBlock = 1;
nMaxMoneyOut = 30000000 * COIN;
nMaxMoneyOut = 100000000 * COIN;
genesis = CreateGenesisBlock(1542950925, 469310, 0x1e0ffff0, 1, 0 * COIN);


Expand Down
24 changes: 20 additions & 4 deletions src/chainparams.h
Expand Up @@ -73,13 +73,12 @@ class CChainParams
int64_t TargetTimespan() const { return nTargetTimespan; }
int64_t TargetSpacing() const { return nTargetSpacing; }
int64_t Interval() const { return nTargetTimespan / nTargetSpacing; }
int LAST_POW_BLOCK() const { return nLastPOWBlock; }

int COINBASE_MATURITY() const { return nMaturity; }
int ModifierUpgradeBlock() const { return nModifierUpdateBlock; }
CAmount MaxMoneyOut() const { return nMaxMoneyOut; }
/** The masternode count that we will allow the see-saw reward payments to be off by */
int MasternodeCountDrift() const { return nMasternodeCountDrift; }
int MasternodeColleteralLimxDev() const { return nMasternodeColleteralLimxDev; }
/** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */
bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; }
/** In the future use NetworkIDString() for RPC fields */
Expand All @@ -104,7 +103,6 @@ class CChainParams
//! Raw pub key bytes for the broadcast alert signing key.
std::vector<unsigned char> vAlertPubKey;
int nDefaultPort;
int nMasternodeColleteralLimxDev;
uint256 bnProofOfWorkLimit;
int nMaxReorganizationDepth;
int nSubsidyHalvingInterval;
Expand All @@ -113,7 +111,6 @@ class CChainParams
int nToCheckBlockUpgradeMajority;
int64_t nTargetTimespan;
int64_t nTargetSpacing;
int nLastPOWBlock;
int nMasternodeCountDrift;
int nMaturity;
int nMaturityMAX;
Expand Down Expand Up @@ -161,6 +158,25 @@ class CModifiableParams
};


inline int64_t MasternodeColleteralLimxDev(int nHeight) {

if(nHeight <= 56000){return 1000;}
else if(nHeight > 56000 && nHeight <= 76000){return 3000;}
else if(nHeight > 76000 && nHeight <= 90000) {return 5000;}
else if(nHeight > 90000 && nHeight <= 110000) {return 7500;}
else if(nHeight > 110000 && nHeight <= 130000) {return 10000;}
else if(nHeight > 130000 && nHeight <= 150000) {return 15000;}
else if(nHeight > 150000 && nHeight <= 160000) {return 30000;}
else if(nHeight > 160000 && nHeight <= 200000) {return 45000;}
else if(nHeight > 200000) {return 100000;}
}

inline int64_t LAST_POW_BLOCK(int nHeight) {

if(nHeight <= 52699){return 300;}
else if(nHeight > 52699){return 52800;}
}

/**
* Return the currently selected parameters. This won't change after app startup
* outside of the unit tests.
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Expand Up @@ -14,7 +14,7 @@
*/

//! These need to be macros, as clientversion.cpp's and worldcryptoforum*-res.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 1
#define CLIENT_VERSION_MAJOR 2
#define CLIENT_VERSION_MINOR 1
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 0
Expand Down
52 changes: 40 additions & 12 deletions src/main.cpp
Expand Up @@ -1619,16 +1619,44 @@ int64_t GetBlockValue(int nHeight)
nSubsidy = 1000 * COIN;
} else if (nHeight > 300 && nHeight <= 30000) {
nSubsidy = 0.5 * COIN;
} else if (nHeight > 30000 && nHeight <= 300000) {
} else if (nHeight == 52701) {
nSubsidy = 1200000 * COIN;
} else if (nHeight > 30000 && nHeight <= 56000) {
nSubsidy = 14 * COIN;
} else if (nHeight > 300000 && nHeight <= 600000) {
nSubsidy = 11 * COIN;
} else if (nHeight > 600000 && nHeight <= 800000) {
nSubsidy = 8 * COIN;
} else if (nHeight > 800000 && nHeight <= 3000000) {
nSubsidy = 6 * COIN;
} else if (nHeight > 3000000) {
nSubsidy = 5 * COIN;
} else if (nHeight > 56000 && nHeight <= 60000) {
nSubsidy = 70 * COIN;
} else if (nHeight > 60000 && nHeight <= 67000) {
nSubsidy = 80 * COIN;
} else if (nHeight > 67000 && nHeight <= 76000) {
nSubsidy = 90 * COIN;
} else if (nHeight > 76000 && nHeight <= 83000) {
nSubsidy = 100 * COIN;
} else if (nHeight > 83000 && nHeight <= 90000) {
nSubsidy = 110 * COIN;
} else if (nHeight > 90000 && nHeight <= 100000) {
nSubsidy = 120 * COIN;
} else if (nHeight > 100000 && nHeight <= 110000) {
nSubsidy = 130 * COIN;
} else if (nHeight > 110000 && nHeight <= 120000) {
nSubsidy = 150 * COIN;
} else if (nHeight > 120000 && nHeight <= 130000) {
nSubsidy = 160 * COIN;
} else if (nHeight > 130000 && nHeight <= 140000) {
nSubsidy = 300 * COIN;
} else if (nHeight > 140000 && nHeight <= 150000) {
nSubsidy = 320 * COIN;
} else if (nHeight > 150000 && nHeight <= 160000) {
nSubsidy = 310 * COIN;
} else if (nHeight > 160000 && nHeight <= 170000) {
nSubsidy = 300 * COIN;
} else if (nHeight > 170000 && nHeight <= 180000) {
nSubsidy = 250 * COIN;
} else if (nHeight > 180000 && nHeight <= 200000) {
nSubsidy = 200 * COIN;
} else if (nHeight > 200000 && nHeight <= 500000) {
nSubsidy = 100 * COIN;
} else if (nHeight > 500000) {
nSubsidy = 50 * COIN;
}
return nSubsidy;
}
Expand Down Expand Up @@ -2054,11 +2082,11 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
return true;
}

if (pindex->nHeight <= Params().LAST_POW_BLOCK() && block.IsProofOfStake())
if (pindex->nHeight <= LAST_POW_BLOCK(chainActive.Height()) && block.IsProofOfStake())
return state.DoS(100, error("ConnectBlock() : PoS period not active"),
REJECT_INVALID, "PoS-early");

if (pindex->nHeight > Params().LAST_POW_BLOCK() && block.IsProofOfWork())
if (pindex->nHeight > LAST_POW_BLOCK(chainActive.Height()) && block.IsProofOfWork())
return state.DoS(100, error("ConnectBlock() : PoW period ended"),
REJECT_INVALID, "PoW-ended");

Expand Down Expand Up @@ -3522,7 +3550,7 @@ bool TestBlockValidity(CValidationState& state, const CBlock& block, CBlockIndex
if (!CheckBlock(block, state, fCheckPOW, fCheckMerkleRoot))
return false;
///AAAA
if( pindexPrev->nHeight +1 > Params().LAST_POW_BLOCK()){
if( pindexPrev->nHeight +1 > LAST_POW_BLOCK(chainActive.Height())){
if (!ContextualCheckBlock(block, state, pindexPrev))
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/masternode-payments.cpp
Expand Up @@ -216,7 +216,7 @@ bool IsBlockPayeeValid(const CBlock& block, int nBlockHeight)
return true;
}

const CTransaction& txNew = (nBlockHeight > Params().LAST_POW_BLOCK() ? block.vtx[1] : block.vtx[0]);
const CTransaction& txNew = (nBlockHeight > LAST_POW_BLOCK(chainActive.Height()) ? block.vtx[1] : block.vtx[0]);

//check for masternode payee
if (masternodePayments.IsTransactionValid(txNew, nBlockHeight))
Expand Down
4 changes: 2 additions & 2 deletions src/masternode.cpp
Expand Up @@ -208,7 +208,7 @@ void CMasternode::Check(bool forceCheck)
if (!unitTest) {
CValidationState state;
CMutableTransaction tx = CMutableTransaction();
CAmount testValue = Params().MasternodeColleteralLimxDev() * COIN - 0.01 * COIN;
CAmount testValue = MasternodeColleteralLimxDev(chainActive.Height()) * COIN - 0.01 * COIN;
CTxOut vout = CTxOut(testValue, Params().MasternodeTestDummyAddress());
tx.vin.push_back(vin);
tx.vout.push_back(vout);
Expand Down Expand Up @@ -570,7 +570,7 @@ bool CMasternodeBroadcast::CheckInputsAndAdd(int& nDoS)

CValidationState state;
CMutableTransaction tx = CMutableTransaction();
CAmount testValue = Params().MasternodeColleteralLimxDev() * COIN - 0.01 * COIN;
CAmount testValue = MasternodeColleteralLimxDev(chainActive.Height()) * COIN - 0.01 * COIN;
CTxOut vout = CTxOut(testValue, Params().MasternodeTestDummyAddress());
tx.vin.push_back(vin);
tx.vout.push_back(vout);
Expand Down
2 changes: 1 addition & 1 deletion src/miner.cpp
Expand Up @@ -461,7 +461,7 @@ void BitcoinMiner(CWallet* pwallet, bool fProofOfStake)
MilliSleep(100);

if (fProofOfStake) {
if (chainActive.Tip()->nHeight < Params().LAST_POW_BLOCK()) {
if (chainActive.Tip()->nHeight < LAST_POW_BLOCK(chainActive.Height())) {
MilliSleep(5000);
continue;
}
Expand Down
9 changes: 2 additions & 7 deletions src/pow.cpp
Expand Up @@ -38,16 +38,11 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
return bnNew.GetCompact();
}

if(pindexLast->nHeight >= 76011 && pindexLast->nHeight <= Params().LAST_POW_BLOCK()) {
uint256 bnNew;
bnNew = ~uint256(0) >> 20;
return bnNew.GetCompact();
}

// Proof of Stake
if (pindexLast->nHeight > Params().LAST_POW_BLOCK()) {
if (pindexLast->nHeight > LAST_POW_BLOCK(chainActive.Height())) {
uint256 bnTargetLimit = Params().ProofOfWorkLimit();
if (pindexLast->nHeight <= Params().LAST_POW_BLOCK() + 3 )
if (pindexLast->nHeight <= LAST_POW_BLOCK(chainActive.Height()) + 3 )
return bnTargetLimit.GetCompact();

int64_t nTargetSpacing = Params().TargetSpacing();
Expand Down
2 changes: 1 addition & 1 deletion src/qt/splashscreen.cpp
Expand Up @@ -35,7 +35,7 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle* networkStyle)

// define text to place
QString titleText = tr("WCF Core");
QString versionText = tr("WCF v1.1");
QString versionText = tr("WCF v2.1");
QString copyrightTextBtc = QChar(0xA9) + QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Bitcoin Core developers"));
QString copyrightTextWorldcryptoforum = QChar(0xA9) + QString(" 2014-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Worldcryptoforum Core and PIVX developers"));
QString copyrightTextWCF = QChar(0xA9) + QString(" 2017-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The WCF developers"));
Expand Down
92 changes: 83 additions & 9 deletions src/qt/transactionrecord.cpp
Expand Up @@ -108,28 +108,102 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet*
if(nSubsidy * 90 / 100 == txout.nValue) {
sub.type = TransactionRecord::MNReward;
}
} else if(nHeight > 30000 && nHeight <= 300000) {
} else if(nHeight > 30000 && nHeight <= 56000) {
nSubsidy = 14 * COIN;
if(nSubsidy * 90 / 100 == txout.nValue) {
sub.type = TransactionRecord::MNReward;
}
} else if(nHeight > 300000 && nHeight <= 600000) {
nSubsidy = 11 * COIN;
} else if(nHeight > 888888 && nHeight <= 60000) {
nSubsidy = 70 * COIN;
if(nSubsidy * 90 / 100 == txout.nValue) {
sub.type = TransactionRecord::MNReward;
}
} else if(nHeight > 600000 && nHeight <= 800000) {
nSubsidy = 8 * COIN;

} else if(nHeight > 888888 && nHeight <= 67000) {
nSubsidy = 80 * COIN;
if(nSubsidy * 90 / 100 == txout.nValue) {
sub.type = TransactionRecord::MNReward;
}

} else if(nHeight > 888888 && nHeight <= 76000) {
nSubsidy = 90 * COIN;
if(nSubsidy * 90 / 100 == txout.nValue) {
sub.type = TransactionRecord::MNReward;
}

} else if(nHeight > 888888 && nHeight <= 83000) {
nSubsidy = 100 * COIN;
if(nSubsidy * 90 / 100 == txout.nValue) {
sub.type = TransactionRecord::MNReward;
}

} else if(nHeight > 888888 && nHeight <= 90000) {
nSubsidy = 110 * COIN;
if(nSubsidy * 90 / 100 == txout.nValue) {
sub.type = TransactionRecord::MNReward;
}

} else if(nHeight > 888888 && nHeight <= 100000) {
nSubsidy = 120 * COIN;
if(nSubsidy * 90 / 100 == txout.nValue) {
sub.type = TransactionRecord::MNReward;
}

} else if(nHeight > 888888 && nHeight <= 110000) {
nSubsidy = 130 * COIN;
if(nSubsidy * 90 / 100 == txout.nValue) {
sub.type = TransactionRecord::MNReward;
}

} else if(nHeight > 888888 && nHeight <= 120000) {
nSubsidy = 150 * COIN;
if(nSubsidy * 90 / 100 == txout.nValue) {
sub.type = TransactionRecord::MNReward;
}
} else if(nHeight > 800000 && nHeight <= 3000000) {
nSubsidy = 6 * COIN;

} else if(nHeight > 888888 && nHeight <= 130000) {
nSubsidy = 160 * COIN;
if(nSubsidy * 90 / 100 == txout.nValue) {
sub.type = TransactionRecord::MNReward;
}

} else if(nHeight > 888888 && nHeight <= 140000) {
nSubsidy = 300 * COIN;
if(nSubsidy * 90 / 100 == txout.nValue) {
sub.type = TransactionRecord::MNReward;
}

} else if(nHeight > 888888 && nHeight <= 150000) {
nSubsidy = 320 * COIN;
if(nSubsidy * 90 / 100 == txout.nValue) {
sub.type = TransactionRecord::MNReward;
}

} else if(nHeight > 888888 && nHeight <= 160000) {
nSubsidy = 310 * COIN;
if(nSubsidy * 90 / 100 == txout.nValue) {
sub.type = TransactionRecord::MNReward;
}

} else if(nHeight > 888888 && nHeight <= 170000) {
nSubsidy = 300 * COIN;
if(nSubsidy * 90 / 100 == txout.nValue) {
sub.type = TransactionRecord::MNReward;
}

} else if(nHeight > 888888 && nHeight <= 180000) {
nSubsidy = 250 * COIN;
if(nSubsidy * 90 / 100 == txout.nValue) {
sub.type = TransactionRecord::MNReward;
}

} else if(nHeight > 888888 && nHeight <= 200000) {
nSubsidy = 200 * COIN;
if(nSubsidy * 90 / 100 == txout.nValue) {
sub.type = TransactionRecord::MNReward;
}
} else if(nHeight > 3000000) {
nSubsidy = 5 * COIN;
} else if(nHeight > 500000) {
nSubsidy = 100 * COIN;
if(nSubsidy * 90 / 100 == txout.nValue) {
sub.type = TransactionRecord::MNReward;
}
Expand Down
2 changes: 1 addition & 1 deletion src/txdb.cpp
Expand Up @@ -242,7 +242,7 @@ bool CBlockTreeDB::LoadBlockIndexGuts()
pindexNew->nStakeTime = diskindex.nStakeTime;
pindexNew->hashProofOfStake = diskindex.hashProofOfStake;

if (pindexNew->nHeight <= Params().LAST_POW_BLOCK()) {
if (pindexNew->nHeight <= LAST_POW_BLOCK(chainActive.Height())) {
if (!CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits))
return error("LoadBlockIndex() : CheckProofOfWork failed: %s", pindexNew->ToString());
}
Expand Down

0 comments on commit de5da6c

Please sign in to comment.