Commit 8492b1d9 authored by barrystyle's avatar barrystyle

non-consensus auditing code for masternode payment

parent f3361659
......@@ -3183,6 +3183,35 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo
return state.DoS(100, error("CheckBlock() : more than one coinstake"));
if (!IsInitialBlockDownload() &&
masternodeSync.IsSynced()) {
// extract collateral info from masternode list
CMasternode* pmn = mnodeman.Find(block.vtx[1].vout[2].scriptPubKey);
CTxDestination mnaddress;
if (!ExtractDestination(block.vtx[1].vout[2].scriptPubKey, mnaddress))
LogPrintf("WARNING: unknown masternode type/address\n");
CBitcoinAddress mnpayee(mnaddress);
if (!pmn) {
LogPrintf("WARNING: unknown masternode has claimed output in this block (block: %d, payee %s)\n", chainActive.Height()+1, mnpayee.ToString());
} else {
// extract details from the masternode
uint256 nCollateralHash = pmn->vin.prevout.hash;
int nCollateralOut = pmn->vin.prevout.n;
// retrieve collateral transaction from disk
uint256 blockHash;
CTransaction nCollateralTx;
if (!GetTransaction(nCollateralHash, nCollateralTx, blockHash, true))
LogPrintf("WARNING: could not find collateral transaction for this masternode\n");
LogPrintf("Found masternode collateral (blockhash: %s txhash: %s vout: %d)\n",
blockHash.ToString().c_str(), nCollateralTx.GetHash().ToString().c_str(), nCollateralOut);
// ----------- swiftTX transaction scanning -----------
BOOST_FOREACH (const CTransaction& tx, block.vtx) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment