SelectBlockFromCandidates function

From Peercoin Wiki
Revision as of 18:10, 23 June 2015 by River (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Source code

The SelectBlockFromCandidates function code can be found in the kernel.cpp file (v0.4.0ppc).


Select a block from the candidate blocks in vSortedByTimestamp, excluding already selected blocks in vSelectedBlocks, and with timestamp up to nSelectionIntervalStop.



Name Type Description
vSortedByTimestamp vector<pair<int64, uint256>>& Timestamp sorted map containing all the block candidates
mapSelectedBlocks map<uint256, const CBlockIndex*>& Map containing all the already selected blocks
nSelectionIntervalStop int64
nStakeModifierPrev uint64
pindexSelected const CBlockIndex**

Return value

Type Description
bool true if block successfully selected, otherwise false


This function looks awfully complex. There is probably a reason for it. Can somebody explain?

Feel free to add your own questions in this FAQ