mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
clean up invariant check for IOUescrow + remove (now) unwanted testcase
This commit is contained in:
@@ -268,7 +268,7 @@ NoZeroEscrow::visitEntry(
|
||||
{
|
||||
auto isBad = [](STAmount const& amount) {
|
||||
if (!amount.native())
|
||||
return true;
|
||||
return (amount <= beast::zero);
|
||||
|
||||
if (amount.xrp() <= XRPAmount{0})
|
||||
return true;
|
||||
@@ -294,19 +294,12 @@ NoZeroEscrow::finalize(
|
||||
ReadView const& rv,
|
||||
beast::Journal const& j)
|
||||
{
|
||||
// bypass this invariant check for IOU escrows
|
||||
if (bad_ && rv.rules().enabled(featurePaychanAndEscrowForTokens) &&
|
||||
txn.isFieldPresent(sfTransactionType))
|
||||
{
|
||||
uint16_t tt = txn.getFieldU16(sfTransactionType);
|
||||
if (tt == ttESCROW_CANCEL || tt == ttESCROW_FINISH)
|
||||
return true;
|
||||
|
||||
if (txn.isFieldPresent(sfAmount) &&
|
||||
!isXRP(txn.getFieldAmount(sfAmount)))
|
||||
return true;
|
||||
}
|
||||
|
||||
// if the amendment isn't enabled and this is a non-XRP escrow then it's bad
|
||||
if (!rv.rules().enabled(featurePaychanAndEscrowForTokens) &&
|
||||
txn.isFieldPresent(sfAmount) &&
|
||||
!isXRP(txn.getFieldAmount(sfAmount)))
|
||||
bad_ = true;
|
||||
|
||||
if (bad_)
|
||||
{
|
||||
JLOG(j.fatal()) << "Invariant failed: escrow specifies invalid amount";
|
||||
|
||||
Reference in New Issue
Block a user