test git diff
This commit is contained in:
@@ -606,6 +606,51 @@ UniValue getblockhash(const UniValue& params, bool fHelp)
|
||||
return pblockindex->GetBlockHash().GetHex();
|
||||
}
|
||||
|
||||
extern uint64_t ASSETCHAINS_STAKED;
|
||||
|
||||
UniValue getlastsegidstakes(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 1)
|
||||
throw runtime_error(
|
||||
"getlastsegidstakes depth\n"
|
||||
"\nReturns object containing the counts of the last X blocks staked by each segid.\n"
|
||||
"\nArguments:\n"
|
||||
"1. depth (numeric, required) The amount of blocks to scan back."
|
||||
"\nResult:\n"
|
||||
"{\n"
|
||||
" \"0\" : n, (numeric) number of stakes from segid 0 in the last X blocks.\n"
|
||||
" .....\n"
|
||||
"}\n"
|
||||
"\nExamples:\n"
|
||||
+ HelpExampleCli("getlastsegidstakes", "1000")
|
||||
+ HelpExampleRpc("getlastsegidstakes", "1000")
|
||||
);
|
||||
|
||||
if ( ASSETCHAINS_STAKED == 0 )
|
||||
throw runtime_error("Only applies to ac_staked chains\n");
|
||||
|
||||
LOCK(cs_main);
|
||||
|
||||
int depth = params[0].get_int();
|
||||
int32_t segids[64] = {0};
|
||||
|
||||
for (int64_t i = chainActive.Height(); i > chainActive.Height()-depth; i--)
|
||||
{
|
||||
CBlockIndex* pblockindex = chainActive[i];
|
||||
if ( pblockindex->segid >= 0 )
|
||||
segids[pblockindex->segid] += 1;
|
||||
}
|
||||
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
for (int8_t i = 0; i < 64; i++)
|
||||
{
|
||||
char str[4];
|
||||
sprintf(str, "%d", i);
|
||||
ret.push_back(Pair(str,segids[i]));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*uint256 _komodo_getblockhash(int32_t nHeight)
|
||||
{
|
||||
uint256 hash;
|
||||
@@ -859,7 +904,7 @@ UniValue kvsearch(const UniValue& params, bool fHelp)
|
||||
" \"currentheight\": xxxxx, (numeric) current height of the chain\n"
|
||||
" \"key\": \"xxxxx\", (string) key\n"
|
||||
" \"keylen\": xxxxx, (string) length of the key \n"
|
||||
" \"owner\": \"xxxxx\" (string) hex string representing the owner of the key \n"
|
||||
" \"owner\": \"xxxxx\" (string) hex string representing the owner of the key \n"
|
||||
" \"height\": xxxxx, (numeric) height the key was stored at\n"
|
||||
" \"expiration\": xxxxx, (numeric) height the key will expire\n"
|
||||
" \"flags\": x (numeric) 1 if the key was created with a password; 0 otherwise.\n"
|
||||
|
||||
@@ -74,6 +74,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
|
||||
{ "getblockheader", 1 },
|
||||
{ "gettransaction", 1 },
|
||||
{ "getrawtransaction", 1 },
|
||||
{ "getlastsegidstakes", 0 },
|
||||
{ "createrawtransaction", 0 },
|
||||
{ "createrawtransaction", 1 },
|
||||
{ "createrawtransaction", 2 },
|
||||
|
||||
@@ -302,6 +302,7 @@ static const CRPCCommand vRPCCommands[] =
|
||||
{ "blockchain", "getblockhashes", &getblockhashes, true },
|
||||
{ "blockchain", "getblockhash", &getblockhash, true },
|
||||
{ "blockchain", "getblockheader", &getblockheader, true },
|
||||
{ "blockchain", "getlastsegidstakes", &getlastsegidstakes, true },
|
||||
{ "blockchain", "getchaintips", &getchaintips, true },
|
||||
{ "blockchain", "getdifficulty", &getdifficulty, true },
|
||||
{ "blockchain", "getmempoolinfo", &getmempoolinfo, true },
|
||||
@@ -364,16 +365,16 @@ static const CRPCCommand vRPCCommands[] =
|
||||
|
||||
// auction
|
||||
{ "auction", "auctionaddress", &auctionaddress, true },
|
||||
|
||||
|
||||
// lotto
|
||||
{ "lotto", "lottoaddress", &lottoaddress, true },
|
||||
|
||||
|
||||
// fsm
|
||||
{ "FSM", "FSMaddress", &FSMaddress, true },
|
||||
{ "FSM", "FSMcreate", &FSMcreate, true },
|
||||
{ "FSM", "FSMlist", &FSMlist, true },
|
||||
{ "FSM", "FSMinfo", &FSMinfo, true },
|
||||
|
||||
|
||||
// rewards
|
||||
{ "rewards", "rewardslist", &rewardslist, true },
|
||||
{ "rewards", "rewardsinfo", &rewardsinfo, true },
|
||||
@@ -382,7 +383,7 @@ static const CRPCCommand vRPCCommands[] =
|
||||
{ "rewards", "rewardslock", &rewardslock, true },
|
||||
{ "rewards", "rewardsunlock", &rewardsunlock, true },
|
||||
{ "rewards", "rewardsaddress", &rewardsaddress, true },
|
||||
|
||||
|
||||
// faucet
|
||||
{ "faucet", "faucetinfo", &faucetinfo, true },
|
||||
{ "faucet", "faucetfund", &faucetfund, true },
|
||||
@@ -400,7 +401,7 @@ static const CRPCCommand vRPCCommands[] =
|
||||
{ "channels", "channelspayment", &channelspayment, true },
|
||||
{ "channels", "channelsclose", &channelsclose, true },
|
||||
{ "channels", "channelsrefund", &channelsrefund, true },
|
||||
|
||||
|
||||
// Oracles
|
||||
{ "oracles", "oraclesaddress", &oraclesaddress, true },
|
||||
{ "oracles", "oracleslist", &oracleslist, true },
|
||||
|
||||
Reference in New Issue
Block a user