Improve handling of RPC ledger_index argument:

Some RPC commands return `ledger_index` as a quoted numeric
string. This change allows the returned value to be directly
copied and used for follow-on RPC commands.

This commit fixes #3533
This commit is contained in:
Gregory Tsipenyuk
2020-08-05 18:28:20 -04:00
committed by Nik Bougalis
parent 707868be33
commit 801b1580f5
4 changed files with 57 additions and 30 deletions

View File

@@ -228,11 +228,18 @@ public:
}
{
// Request an invalid ledger.
Json::Value args{depositAuthArgs(alice, becky, "17")};
Json::Value args{depositAuthArgs(alice, becky, "-1")};
Json::Value const result{
env.rpc("json", "deposit_authorized", args.toStyledString())};
verifyErr(result, "invalidParams", "ledgerIndexMalformed");
}
{
// Request a ledger that doesn't exist yet as a string.
Json::Value args{depositAuthArgs(alice, becky, "17")};
Json::Value const result{
env.rpc("json", "deposit_authorized", args.toStyledString())};
verifyErr(result, "lgrNotFound", "ledgerNotFound");
}
{
// Request a ledger that doesn't exist yet.
Json::Value args{depositAuthArgs(alice, becky)};