diff --git a/src/test/app/LoanBroker_test.cpp b/src/test/app/LoanBroker_test.cpp index d2a8a3656d..6f9cffbf1d 100644 --- a/src/test/app/LoanBroker_test.cpp +++ b/src/test/app/LoanBroker_test.cpp @@ -1015,6 +1015,24 @@ class LoanBroker_test : public beast::unit_test::suite sig(sfCounterpartySignature, alice), fee(env.current()->fees().base * 2)); + // preflight: temINVALID (empty broker id) + { + auto jv = del(alice, brokerKeylet.key); + jv[sfLoanBrokerID] = ""; + env(jv, ter(temINVALID)); + } + // preflight: temINVALID (zero broker id) + { + // needs a flag to distinguish the parsed STTx from the prior + // test + auto jv = del(alice, uint256{}, tfFullyCanonicalSig); + BEAST_EXPECT( + jv[sfLoanBrokerID] == + "0000000000000000000000000000000000000000000000000000000000" + "000000"); + env(jv, ter(temINVALID)); + } + // preclaim: tecHAS_OBLIGATIONS env(del(alice, brokerKeylet.key), ter(tecHAS_OBLIGATIONS)); } diff --git a/src/xrpld/app/tx/detail/LoanBrokerDelete.cpp b/src/xrpld/app/tx/detail/LoanBrokerDelete.cpp index 90703fa5b9..07e05ec073 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerDelete.cpp +++ b/src/xrpld/app/tx/detail/LoanBrokerDelete.cpp @@ -32,6 +32,9 @@ LoanBrokerDelete::checkExtraFeatures(PreflightContext const& ctx) NotTEC LoanBrokerDelete::preflight(PreflightContext const& ctx) { + if (ctx.tx[sfLoanBrokerID] == beast::zero) + return temINVALID; + return tesSUCCESS; }