Added ac-eras parameter, which enables multiple reward eras by allowing other ac_reward releated parameters to accept comma separated lists of values, one for each era

This commit is contained in:
Michael Toutonghi
2018-04-09 22:48:54 -07:00
parent 4ca9edc0d6
commit 36647d52f7
5 changed files with 230 additions and 74 deletions

View File

@@ -18,6 +18,8 @@
#include "komodo_defs.h"
#include <stdarg.h>
#include <sstream>
#include <vector>
#if (defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__))
#include <pthread.h>
@@ -362,6 +364,38 @@ void ParseParameters(int argc, const char* const argv[])
}
}
void SplitToi64(const std::string& strVal, int64_t[_MAX_ERAS] *outVals, const int64_t nDefault)
{
istringstream ss(strVal);
vector<int64_t> vec;
int64_t i, numVals = 0;
while ( ss.peek() == ' ' )
ss.ignore();
while ( ss >> i )
{
outVals[numVals] = i;
numVals += 1;
while ( ss.peek() == ' ' )
ss.ignore();
if ( ss.peek() == ',' )
ss.ignore();
while ( ss.peek() == ' ' )
ss.ignore();
}
if ( numVals > 0 )
nDefault = outVals[numVals - 1];
for ( i=numVals; i < MAX_ERAS; i++ )
{
outVals[i] = nDefault;
}
}
std::string GetArg(const std::string& strArg, const std::string& strDefault)
{
if (mapArgs.count(strArg))