diff --git a/src/test/app/PermissionedDomains_test.cpp b/src/test/app/PermissionedDomains_test.cpp index 7955aa7fe02..52c9e02aa03 100644 --- a/src/test/app/PermissionedDomains_test.cpp +++ b/src/test/app/PermissionedDomains_test.cpp @@ -26,7 +26,6 @@ #include #include -#include #include #include #include @@ -144,6 +143,11 @@ class PermissionedDomains_test : public beast::unit_test::suite {alice7, "credential7"}}; env(pd::setTx(account, credentialsNon, domain), ter(tecNO_ISSUER)); + // Test bad fee + env(pd::setTx(account, credentials11, domain), + fee(1, true), + ter(temBAD_FEE)); + pd::Credentials const credentials4{ {alice2, "credential1"}, {alice3, "credential2"}, @@ -401,6 +405,9 @@ class PermissionedDomains_test : public beast::unit_test::suite // Delete a non-existent domain. env(pd::deleteTx(alice, uint256(75)), ter(tecNO_ENTRY)); + // Test bad fee + env(pd::deleteTx(alice, uint256(75)), ter(temBAD_FEE), fee(1, true)); + // Delete a zero domain. env(pd::deleteTx(alice, uint256(0)), ter(temMALFORMED)); diff --git a/src/test/jtx/fee.h b/src/test/jtx/fee.h index c671e0b2a1e..ab7a743a3d0 100644 --- a/src/test/jtx/fee.h +++ b/src/test/jtx/fee.h @@ -53,7 +53,7 @@ class fee Throw("fee: not XRP"); } - explicit fee(std::uint64_t amount) : fee{STAmount{amount}} + explicit fee(std::uint64_t amount, bool negative = false) : fee{STAmount{amount, negative}} { } diff --git a/src/test/rpc/LedgerRPC_test.cpp b/src/test/rpc/LedgerRPC_test.cpp index 76e9feeb83b..99b0f0a23fc 100644 --- a/src/test/rpc/LedgerRPC_test.cpp +++ b/src/test/rpc/LedgerRPC_test.cpp @@ -3113,6 +3113,26 @@ class LedgerRPC_test : public beast::unit_test::suite jss::PermissionedDomain); } + { + // Fail, invalid permissioned domain index + Json::Value params; + params[jss::ledger_index] = jss::validated; + params[jss::permissioned_domain] = + "12F1F1F1F180D67377B2FAB292A31C922470326268D2B9B74CD1E582645B9A" + "DE"; + auto const jrr = env.rpc("json", "ledger_entry", to_string(params)); + checkErrorValue(jrr[jss::result], "entryNotFound", ""); + } + + { + // Fail, invalid permissioned domain index + Json::Value params; + params[jss::ledger_index] = jss::validated; + params[jss::permissioned_domain] = "NotAHexString"; + auto const jrr = env.rpc("json", "ledger_entry", to_string(params)); + checkErrorValue(jrr[jss::result], "malformedRequest", ""); + } + { // Fail, invalid account Json::Value params;