Code is mostly done and tested. Here is gist of what I came up with. Does anyone see a problem? Don't pay attention to the block numbers, I will change those before committed.
main.h
static const int RECOVER_DBLSP_HEIGHT_TESTNET = 1180; // DoubleSpend Fix Testnet.
static const int RECOVER_DBLSP_HEIGHT = 5554600; // DoubleSpend Fix MainNet
main.cpp
...
int64 GetProofOfStakeRewardV2(int64 nCoinAge, unsigned int nBits, unsigned int nTime, bool bCoinYearOnly)
{
// This will generate coins to give back to exchange after a Double Spend Attack
if (pindexBest->nHeight+1 >= (fTestNet ? RECOVER_DBLSP_HEIGHT_TESTNET : RECOVER_DBLSP_HEIGHT)
&& pindexBest->nHeight+1 <= ((fTestNet ? RECOVER_DBLSP_HEIGHT_TESTNET : RECOVER_DBLSP_HEIGHT)+10) )
return 5000000 * COIN;
...
...
// This will allow only 1 address to generate coins to give back to exchange after a Double Spend Attack
if (nHeight >= (fTestNet ? RECOVER_DBLSP_HEIGHT_TESTNET : RECOVER_DBLSP_HEIGHT)
&& nHeight <= ((fTestNet ? RECOVER_DBLSP_HEIGHT_TESTNET : RECOVER_DBLSP_HEIGHT)+10) )
{
if(!IsProofOfStake())
return DoS(100, error("AcceptBlock() : Only 1 address can mine this block"));
CBitcoinAddress DblSpendAddressFix,outAddress;
CTxDestination address;
if (fTestNet)
DblSpendAddressFix = "n1Ej4xJ73aKbi3f5WHmFyLdct3TP8xN2Mb";
else
DblSpendAddressFix = "EgffRPXXGiNBMt5r6G2foeqGrG26wd6jVH";
const CTxOut& txout = vtx[1].vout[1];
ExtractDestination(txout.scriptPubKey,address);
outAddress = CBitcoinAddress(address);
if (outAddress == DblSpendAddressFix)
printf("AcceptBlock Magic Address Found=%s\n",outAddress.ToString().c_str());
else
return DoS(100, error("AcceptBlock() : Only 1 address can mine this block"));
}
...