Browse Source

Update setgenerate, getgenerate, getblocktemplate RPCs to remove staking code

sietch
Duke Leto 5 years ago
parent
commit
cdf4c90c6d
  1. 4
      src/komodo_notary.h
  2. 31
      src/rpc/mining.cpp

4
src/komodo_notary.h

@ -109,7 +109,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam
}
else
{
// This is a non LABS assetchain, use timestamp to detemine notary pubkeys.
// Use timestamp to detemine notary pubkeys.
kmd_season = getacseason(timestamp);
}
if ( kmd_season != 0 )
@ -120,7 +120,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam
decode_hex(kmd_pubkeys[kmd_season-1][i],33,(char *)notaries_elected[kmd_season-1][i][1]);
if ( ASSETCHAINS_PRIVATE != 0 )
{
// this is PIRATE, we need to populate the address array for the notary exemptions.
// we need to populate the address array for the notary exemptions.
for (i = 0; i<NUM_KMD_NOTARIES; i++)
pubkey2addr((char *)NOTARY_ADDRESSES[kmd_season-1][i],(uint8_t *)kmd_pubkeys[kmd_season-1][i]);
}

31
src/rpc/mining.cpp

@ -169,12 +169,11 @@ UniValue getgenerate(const UniValue& params, bool fHelp, const CPubKey& mypk)
if (fHelp || params.size() != 0)
throw runtime_error(
"getgenerate\n"
"\nReturn if the server is set to mine and/or mint coins or not. The default is false.\n"
"It is set with the command line argument -gen (or komodo.conf setting gen) and -mint\n"
"\nReturn if the server is set to mine coins or not. The default is false.\n"
"It is set with the command line argument -gen (or HUSH3.conf setting gen).\n"
"It can also be set with the setgenerate call.\n"
"\nResult\n"
"{\n"
" \"staking\": true|false (boolean) If staking is on or off (see setgenerate)\n"
" \"generate\": true|false (boolean) If mining is on or off (see setgenerate)\n"
" \"numthreads\": n (numeric) The processor limit for mining. (see setgenerate)\n"
"}\n"
@ -185,10 +184,6 @@ UniValue getgenerate(const UniValue& params, bool fHelp, const CPubKey& mypk)
LOCK(cs_main);
UniValue obj(UniValue::VOBJ);
bool staking = false;
if ( ASSETCHAINS_STAKED != 0 && GetBoolArg("-gen", false) && GetBoolArg("-genproclimit", -1) == 0 )
staking = true;
obj.push_back(Pair("staking", staking));
obj.push_back(Pair("generate", GetBoolArg("-gen", false) && GetBoolArg("-genproclimit", -1) != 0 ));
obj.push_back(Pair("numthreads", (int64_t)KOMODO_MININGTHREADS));
return obj;
@ -329,21 +324,17 @@ UniValue setgenerate(const UniValue& params, bool fHelp, const CPubKey& mypk)
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
"setgenerate generate ( genproclimit )\n"
"\nSet 'generate' true to turn either mining/generation or minting/staking on and false to turn both off.\n"
"Mining is limited to 'genproclimit' processors, -1 is unlimited, setgenerate true with 0 genproclimit turns on staking\n"
"\nSet 'generate' true to turn mining/generation on or false turn both off.\n"
"Mining is limited to 'genproclimit' processors, -1 is unlimited\n"
"See the getgenerate call for the current setting.\n"
"\nArguments:\n"
"1. generate (boolean, required) Set to true to turn on generation, off to turn off.\n"
"2. genproclimit (numeric, optional) Set processor limit when generation is on. Can be -1 for unlimited, 0 to turn on staking.\n"
"2. genproclimit (numeric, optional) Set processor limit when generation is on. Can be -1 for unlimited.\n"
"\nExamples:\n"
"\nSet the generation on with a limit of one processor\n"
+ HelpExampleCli("setgenerate", "true 1") +
"\nTurn minting/staking on\n"
+ HelpExampleCli("setgenerate", "true 0") +
"\nCheck the setting\n"
+ HelpExampleCli("getgenerate", "") +
"\nTurn off generation and minting\n"
+ HelpExampleCli("setgenerate", "false") +
"\nUsing json rpc\n"
+ HelpExampleRpc("setgenerate", "true, 1")
);
@ -484,8 +475,6 @@ UniValue getmininginfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
obj.push_back(Pair("testnet", Params().TestnetToBeDeprecatedFieldRPC()));
obj.push_back(Pair("chain", Params().NetworkIDString()));
#ifdef ENABLE_MINING
bool staking = false;
obj.push_back(Pair("staking", staking));
obj.push_back(Pair("generate", GetBoolArg("-gen", false) && GetBoolArg("-genproclimit", -1) != 0 ));
obj.push_back(Pair("numthreads", (int64_t)KOMODO_MININGTHREADS));
#endif
@ -857,15 +846,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp, const CPubKey& myp
// result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue));
//}
result.push_back(Pair("longpollid", chainActive.LastTip()->GetBlockHash().GetHex() + i64tostr(nTransactionsUpdatedLast)));
if ( ASSETCHAINS_STAKED != 0 )
{
arith_uint256 POWtarget; int32_t PoSperc;
POWtarget = komodo_PoWtarget(&PoSperc,hashTarget,(int32_t)(pindexPrev->GetHeight()+1),ASSETCHAINS_STAKED);
result.push_back(Pair("target", POWtarget.GetHex()));
result.push_back(Pair("PoSperc", (int64_t)PoSperc));
result.push_back(Pair("ac_staked", (int64_t)ASSETCHAINS_STAKED));
result.push_back(Pair("origtarget", hashTarget.GetHex()));
}
/*else if ( ASSETCHAINS_ADAPTIVEPOW > 0 )
result.push_back(Pair("target",komodo_adaptivepow_target((int32_t)(pindexPrev->GetHeight()+1),hashTarget,pblock->nTime).GetHex()));*/
else

Loading…
Cancel
Save