fix
This commit is contained in:
@@ -115,21 +115,32 @@ UniValue getiguanajson(const UniValue& params, bool fHelp)
|
||||
|
||||
UniValue getnotarysendmany(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 1)
|
||||
throw runtime_error("getnotarysendmany <amount to send>");
|
||||
// era
|
||||
int32_t era = getera(time(NULL));
|
||||
if (fHelp || params.size() > 2)
|
||||
throw runtime_error(
|
||||
"getnotarysendmany ( era amount_to_send )\n"
|
||||
"\nReturn a sendmany array for all notary address in defined era.\n"
|
||||
);
|
||||
int era = 0;
|
||||
if (params.size() > 0) {
|
||||
era = params[0].get_int();
|
||||
}
|
||||
if (era < 0 || era > NUM_STAKED_ERAS) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "era is not valid");
|
||||
}
|
||||
// Amount
|
||||
CAmount nAmount = AmountFromValue(params[0]);
|
||||
if (params.size() > 1)
|
||||
CAmount nAmount = AmountFromValue(params[1]);
|
||||
|
||||
if (nAmount <= 0)
|
||||
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for send");
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
for (int i = 0; i<num_notaries_STAKED[era]; i++)
|
||||
{
|
||||
char ADDRESS[36]; uint8_t pubkey[33];
|
||||
decode_hex(pubkey,33,(char *)notaries_STAKED[era][i][1]);
|
||||
pubkey2addr((char *)ADDRESS,(uint8_t *)pubkey);
|
||||
ret.push_back(Pair(ADDRESS,ValueFromAmount(nAmount)));
|
||||
char Raddress[18]; uint8_t pubkey33[33];
|
||||
decode_hex(pubkey33,33,(char *)notaries_STAKED[era][i][1]);
|
||||
pubkey2addr((char *)Raddress,(uint8_t *)pubkey33);
|
||||
fprintf(stderr, "radd: %s\n",Raddress);
|
||||
ret.push_back(Pair(Raddress,ValueFromAmount(nAmount)));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user