mnbudget nextblock

This commit is contained in:
Evan Duffield 2015-08-29 16:51:31 -07:00
parent fd22143a1b
commit eb5f8922b4

View File

@ -24,7 +24,7 @@ Value mnbudget(const Array& params, bool fHelp)
strCommand = params[0].get_str(); strCommand = params[0].get_str();
if (fHelp || if (fHelp ||
(strCommand != "vote-many" && strCommand != "prepare" && strCommand != "submit" && strCommand != "vote" && strCommand != "getvotes" && strCommand != "getinfo" && strCommand != "show" && strCommand != "projection" && strCommand != "check")) (strCommand != "vote-many" && strCommand != "prepare" && strCommand != "submit" && strCommand != "vote" && strCommand != "getvotes" && strCommand != "getinfo" && strCommand != "show" && strCommand != "projection" && strCommand != "check" && strCommand != "nextblock"))
throw runtime_error( throw runtime_error(
"mnbudget \"command\"... ( \"passphrase\" )\n" "mnbudget \"command\"... ( \"passphrase\" )\n"
"Vote or show current budgets\n" "Vote or show current budgets\n"
@ -39,8 +39,18 @@ Value mnbudget(const Array& params, bool fHelp)
" show - Show all budgets\n" " show - Show all budgets\n"
" projection - Show the projection of which proposals will be paid the next cycle\n" " projection - Show the projection of which proposals will be paid the next cycle\n"
" check - Scan proposals and remove invalid\n" " check - Scan proposals and remove invalid\n"
" nextblock - Get next superblock for budget system\n"
); );
if(strCommand == "nextblock")
{
CBlockIndex* pindexPrev = chainActive.Tip();
if(!pindexPrev) return "unknown";
int nNext = pindexPrev->nHeight - pindexPrev->nHeight % GetBudgetPaymentCycleBlocks() + GetBudgetPaymentCycleBlocks();
return nNext;
}
if(strCommand == "prepare") if(strCommand == "prepare")
{ {
int nBlockMin = 0; int nBlockMin = 0;