This commit is contained in:
Richard Holland
2023-12-27 12:19:56 +00:00
parent cb4111095c
commit 76f61e56bf
3 changed files with 19 additions and 14 deletions

View File

@@ -438,7 +438,8 @@ EscrowFinish::preflight(PreflightContext const& ctx)
if (!ctx.tx.isFieldPresent(sfOfferSequence))
return temMALFORMED;
if (ctx.tx.isFieldPresent(sfEscrowID) && ctx.tx.getFieldU32(sfOfferSequence) != 0)
if (ctx.tx.isFieldPresent(sfEscrowID) &&
ctx.tx.getFieldU32(sfOfferSequence) != 0)
return temMALFORMED;
}
else
@@ -720,7 +721,8 @@ EscrowCancel::preflight(PreflightContext const& ctx)
if (!ctx.tx.isFieldPresent(sfOfferSequence))
return temMALFORMED;
if (ctx.tx.isFieldPresent(sfEscrowID) && ctx.tx.getFieldU32(sfOfferSequence) != 0)
if (ctx.tx.isFieldPresent(sfEscrowID) &&
ctx.tx.getFieldU32(sfOfferSequence) != 0)
return temMALFORMED;
}
else

View File

@@ -240,7 +240,7 @@ URIToken::preclaim(PreclaimContext const& ctx)
if (purchaseAmount.native() && saleAmount->native())
{
// native transfer
STAmount needed{ctx.view.fees().accountReserve(
sle->getFieldU32(sfOwnerCount) + 1)};
@@ -267,16 +267,20 @@ URIToken::preclaim(PreclaimContext const& ctx)
// iou transfer
STAmount availableFunds{accountFunds(
ctx.view, acc, purchaseAmount, fhZERO_IF_FROZEN, ctx.j)};
ctx.view,
acc,
purchaseAmount,
fhZERO_IF_FROZEN,
ctx.j)};
if (purchaseAmount > availableFunds)
return tecINSUFFICIENT_FUNDS;
}
}
else
{
{
// old logic
if (purchaseAmount.native() && saleAmount->native())
{
// if it's an xrp sale/purchase then no trustline needed
@@ -288,12 +292,15 @@ URIToken::preclaim(PreclaimContext const& ctx)
{
// iou
STAmount availableFunds{accountFunds(
ctx.view, acc, purchaseAmount, fhZERO_IF_FROZEN, ctx.j)};
ctx.view,
acc,
purchaseAmount,
fhZERO_IF_FROZEN,
ctx.j)};
if (purchaseAmount > availableFunds)
return tecINSUFFICIENT_FUNDS;
}
}
return tesSUCCESS;
}

View File

@@ -455,12 +455,8 @@ struct URIToken_test : public beast::unit_test::suite
// setup env
Env env{
*this,
envconfig(),
features,
nullptr,
beast::severities::kWarning
//beast::severities::kTrace
*this, envconfig(), features, nullptr, beast::severities::kWarning
// beast::severities::kTrace
};
auto const alice = Account("alice");
auto const bob = Account("bob");