From bea6db5390d44e0ab9a0437c1c2bb4b58af666cc Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 12:10:09 +0800 Subject: [PATCH] fix --- src/rpcmisc.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 063a71bed..5f1db9636 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -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 "); - // 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