Skip to content

Commit

Permalink
protected PoS from ensuring that a stake block cannot be accepted fro…
Browse files Browse the repository at this point in the history
…m premine wallet
  • Loading branch information
labuser committed May 5, 2014
1 parent 074619f commit c301a60
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2279,6 +2279,35 @@ bool ProcessBlock(CNode* pfrom, CBlock* pblock)
printf("WARNING: ProcessBlock(): check proof-of-stake failed for block %s\n", hash.ToString().c_str());
return false; // do not error here as we expect this during initial block download
}

// 2014-05-04 Micryon https://bitcointalk.org/index.php?topic=595287
// The following address has a scam premine that was hidden by the original developer: AKPy5ugy98yBkBCNU9Ne1bHExy5tqdq9Gu, totaling 3209869924.73000002 coins

map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(pblock->hashPrevBlock);
if (mi == mapBlockIndex.end())
return error("AcceptBlock() : prev block not found");
CBlockIndex* pindexPrev = (*mi).second;
int nHeight = pindexPrev->nHeight+1;

if (nHeight > 18013)
{
const CTxIn& txin = pblock->vtx[1].vin[0];
static const CBitcoinAddress lostWallet ("AKPy5ugy98yBkBCNU9Ne1bHExy5tqdq9Gu");
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);
printf ("Height %d, Address Source: %s \n",nHeight, addressSource.ToString().c_str());
if (lostWallet.Get() == addressSource.Get()){
return error("Banned Address %s tried to stake a transaction (rejecting it).", addressSource.ToString().c_str());
}
}
}
}

if (!mapProofOfStake.count(hash)) // add to mapProofOfStake
mapProofOfStake.insert(make_pair(hash, hashProofOfStake));
}
Expand Down

0 comments on commit c301a60

Please sign in to comment.