Skip to content

Commit

Permalink
adds burn address scanning tothe masternode check function
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro-at-decenomy committed Apr 16, 2022
1 parent 5d4e26b commit 90386ea
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/masternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ void CMasternode::Check(bool forceCheck)
{
if (ShutdownRequested()) return;

const Consensus::Params& consensus = Params().GetConsensus();

// todo: add LOCK(cs) but be careful with the AcceptableInputs() below that requires cs_main.

if (!forceCheck && (GetTime() - lastTimeChecked < MASTERNODE_CHECK_SECONDS)) return;
Expand Down Expand Up @@ -229,6 +231,19 @@ void CMasternode::Check(bool forceCheck)
return;
}
}

// ----------- burn address scanning -----------
if (!consensus.mBurnAddresses.empty()) {

std::string addr = EncodeDestination(pubKeyCollateralAddress.GetID());

if (consensus.mBurnAddresses.find(addr) != consensus.mBurnAddresses.end() &&
consensus.mBurnAddresses.at(addr) < chainActive.Height()
) {
activeState = MASTERNODE_VIN_SPENT;
return;
}
}
}

activeState = MASTERNODE_ENABLED; // OK
Expand Down

0 comments on commit 90386ea

Please sign in to comment.