Get the last stake modifier and its generation time from a given block
| 133 | |
| 134 | // Get the last stake modifier and its generation time from a given block |
| 135 | static bool GetLastStakeModifier(const CBlockIndex* pindex, uint64_t& nStakeModifier, int64_t& nModifierTime) { |
| 136 | if (!pindex) |
| 137 | return error("%s: null pindex", __func__); |
| 138 | |
| 139 | while (pindex && pindex->pprev && !pindex->GeneratedStakeModifier()) |
| 140 | pindex = pindex->pprev; |
| 141 | |
| 142 | if (!pindex->GeneratedStakeModifier()) |
| 143 | return error("%s: no generation at genesis block", __func__); |
| 144 | |
| 145 | nStakeModifier = pindex->nStakeModifier; |
| 146 | nModifierTime = pindex->GetBlockTime(); |
| 147 | return true; |
| 148 | } |
| 149 | |
| 150 | // Get selection interval (nSection in seconds) |
| 151 | static int64_t GetSelectionInterval(int nSection) { |
no test coverage detected