mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
Fix LoanBrokerDelete with empty or zero broker ID (RIPD-3858) (#5967)
This commit is contained in:
committed by
GitHub
parent
7a758a42f9
commit
e8dddcbb7f
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user