MCPcopy Create free account
hub / github.com/LUX-Core/lux / IsBlockStaked

Method IsBlockStaked

src/stake.cpp:910–923  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

908}
909
910bool Stake::IsBlockStaked(int nHeight) const {
911 auto it = mapHashedBlocks.find(nHeight);
912 if (it != mapHashedBlocks.end()) {
913 auto const nStakingInterval=Params().StakingInterval();
914 if (nHashInterval < nStakingInterval) {
915 auto that = const_cast<Stake*>(this);
916 that->nHashInterval = nStakingInterval;
917 }
918 if (GetTime() - it->second < max(nHashInterval, (unsigned int) 1)) {
919 return true;
920 }
921 }
922 return false;
923}
924
925bool Stake::IsBlockStaked(const CBlock* block) const{
926 return block->IsProofOfStake() && mapStakes.find(block->vtx[1].vin[0].prevout) != mapStakes.end();

Callers 1

ProcessNewBlockFunction · 0.80

Calls 7

GetTimeFunction · 0.85
maxFunction · 0.85
StakingIntervalMethod · 0.80
ParamsClass · 0.70
findMethod · 0.45
endMethod · 0.45
IsProofOfStakeMethod · 0.45

Tested by

no test coverage detected