Commit 0ec17b6 1 parent 838978b commit 0ec17b6 Copy full SHA for 0ec17b6
File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -316,13 +316,32 @@ class AMMInfo_test : public jtx::AMMTestBase
316
316
});
317
317
}
318
318
319
+ void
320
+ testInvalidAmmField ()
321
+ {
322
+ using namespace jtx ;
323
+ testcase (" Invalid amm field" );
324
+
325
+ testAMM ([&](AMM& amm, Env&) {
326
+ auto const resp = amm.ammRpcInfo (
327
+ std::nullopt,
328
+ jss::validated.c_str (),
329
+ std::nullopt,
330
+ std::nullopt,
331
+ gw);
332
+ BEAST_EXPECT (
333
+ resp.isMember (" error" ) && resp[" error" ] == " actNotFound" );
334
+ });
335
+ }
336
+
319
337
void
320
338
run () override
321
339
{
322
340
testErrors ();
323
341
testSimpleRpc ();
324
342
testVoteAndBid ();
325
343
testFreeze ();
344
+ testInvalidAmmField ();
326
345
}
327
346
};
328
347
Original file line number Diff line number Diff line change @@ -132,6 +132,8 @@ doAMMInfo(RPC::JsonContext& context)
132
132
if (!sle)
133
133
return Unexpected (rpcACT_MALFORMED);
134
134
ammID = sle->getFieldH256 (sfAMMID);
135
+ if (ammID->isZero ())
136
+ return Unexpected (rpcACT_NOT_FOUND);
135
137
}
136
138
137
139
if (params.isMember (jss::account))
You can’t perform that action at this time.
0 commit comments