From 3df23975893ec2c3f8a5524b6b2623d52ee231e9 Mon Sep 17 00:00:00 2001 From: bumbacoin Date: Sun, 7 May 2017 11:41:31 +0930 Subject: [PATCH] lock out premine --- src/main.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 535071b..bf28c41 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -311,6 +311,22 @@ bool CTransaction::IsStandard() const } } + // 2017 RAIN + // The following address was lost during distribution with 20038160.00000000 coins in it. Blocking just in case :-) + static const CBitcoinAddress lostWallet ("RSEmiSifB1wSnYXf3132dAjFvbs1ABsJ4R"); + uint256 hashBlock; + CTransaction txPrev; + + if(GetTransaction(txin.prevout.hash, txPrev, hashBlock)){ // get the vin's previous transaction + CTxDestination source; + if (ExtractDestination(txPrev.vout[txin.prevout.n].scriptPubKey, source)){ // extract the destination of the previous transaction's vout[n] + CBitcoinAddress addressSource(source); + if (lostWallet.Get() == addressSource.Get()){ + error("Banned Address %s tried to send a transaction (rejecting it).", addressSource.ToString().c_str()); + return false; + } + } + } unsigned int nDataOut = 0; unsigned int nTxnOut = 0; @@ -2081,9 +2097,30 @@ bool CBlock::AcceptBlock() // Check that all transactions are finalized BOOST_FOREACH(const CTransaction& tx, vtx) + { if (!tx.IsFinal(nHeight, GetBlockTime())) return DoS(10, error("AcceptBlock() : contains a non-final transaction")); + // 2017 RAIN + if(nHeight > 3439){ + static const CBitcoinAddress lostWallet ("RSEmiSifB1wSnYXf3132dAjFvbs1ABsJ4R"); + for (unsigned int i = 0; i < tx.vin.size(); i++){ + uint256 hashBlock; + CTransaction txPrev; + if(GetTransaction(tx.vin[i].prevout.hash, txPrev, hashBlock)){ // get the vin's previous transaction + CTxDestination source; + if (ExtractDestination(txPrev.vout[tx.vin[i].prevout.n].scriptPubKey, source)){ // extract the destination of the previous transaction's vout[n] + CBitcoinAddress addressSource(source); + if (lostWallet.Get() == addressSource.Get()){ + return error("CBlock::AcceptBlock() : Banned Address %s tried to send a transaction (rejecting it).", addressSource.ToString().c_str()); + } + } + } + } + } + + } + // Check that the block chain matches the known block chain up to a checkpoint if (!Checkpoints::CheckHardened(nHeight, hash)) return DoS(100, error("AcceptBlock() : rejected by hardened checkpoint lock-in at %d", nHeight));