Code review results changes

This commit is contained in:
crowning- 2016-09-07 20:32:17 +02:00
parent e1b7b15cca
commit ee85293d27

View File

@ -623,18 +623,6 @@ UniValue voteraw(const UniValue& params, bool fHelp)
UniValue getgovernanceinfo(const UniValue& params, bool fHelp)
{
int nLastSuperblock, nNextSuperblock;
// Get current block height
int nBlockHeight = (int)chainActive.Height();
// Get chain parameters
int nSuperblockStartBlock = Params().GetConsensus().nSuperblockStartBlock;
int nSuperblockCycle = Params().GetConsensus().nSuperblockCycle;
// Get first superblock
int nFirstSuperblock = nSuperblockStartBlock - (nSuperblockStartBlock % nSuperblockCycle) + nSuperblockCycle;
if (fHelp || params.size() != 0) {
throw runtime_error(
"getgovernanceinfo\n"
@ -653,6 +641,20 @@ UniValue getgovernanceinfo(const UniValue& params, bool fHelp)
);
}
// Compute last/next superblock
int nLastSuperblock, nNextSuperblock;
// Get current block height
int nBlockHeight = (int)chainActive.Height();
// Get chain parameters
int nSuperblockStartBlock = Params().GetConsensus().nSuperblockStartBlock;
int nSuperblockCycle = Params().GetConsensus().nSuperblockCycle;
// Get first superblock
int nFirstSuperblockOffset = (nSuperblockCycle - nSuperblockStartBlock % nSuperblockCycle) % nSuperblockCycle;
int nFirstSuperblock = nSuperblockStartBlock + nFirstSuperblockOffset;
if(nBlockHeight < nFirstSuperblock){
nLastSuperblock = 0;
nNextSuperblock = nFirstSuperblock;