mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
merged IOUEscrow amendment
This commit is contained in:
@@ -99,11 +99,14 @@ XRPNotCreated::visitEntry(
|
||||
drops_ -= (*before)[sfBalance].xrp().drops();
|
||||
break;
|
||||
case ltPAYCHAN:
|
||||
drops_ -=
|
||||
((*before)[sfAmount] - (*before)[sfBalance]).xrp().drops();
|
||||
if (isXRP((*before)[sfAmount]))
|
||||
drops_ -=
|
||||
((*before)[sfAmount] - (*before)[sfBalance]).xrp().drops();
|
||||
break;
|
||||
case ltESCROW:
|
||||
drops_ -= (*before)[sfAmount].xrp().drops();
|
||||
if (isXRP((*before)[sfAmount]))
|
||||
drops_ -=
|
||||
(*before)[sfAmount].xrp().drops();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -118,14 +121,14 @@ XRPNotCreated::visitEntry(
|
||||
drops_ += (*after)[sfBalance].xrp().drops();
|
||||
break;
|
||||
case ltPAYCHAN:
|
||||
if (!isDelete)
|
||||
drops_ += ((*after)[sfAmount] - (*after)[sfBalance])
|
||||
.xrp()
|
||||
.drops();
|
||||
if (!isDelete && isXRP((*after)[sfAmount]))
|
||||
drops_ +=
|
||||
((*after)[sfAmount] - (*after)[sfBalance]).xrp().drops();
|
||||
break;
|
||||
case ltESCROW:
|
||||
if (!isDelete)
|
||||
drops_ += (*after)[sfAmount].xrp().drops();
|
||||
if (!isDelete && isXRP((*after)[sfAmount]))
|
||||
drops_ +=
|
||||
(*after)[sfAmount].xrp().drops();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -285,12 +288,25 @@ NoZeroEscrow::visitEntry(
|
||||
|
||||
bool
|
||||
NoZeroEscrow::finalize(
|
||||
STTx const&,
|
||||
STTx const& txn,
|
||||
TER const,
|
||||
XRPAmount const,
|
||||
ReadView const&,
|
||||
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 (bad_)
|
||||
{
|
||||
JLOG(j.fatal()) << "Invariant failed: escrow specifies invalid amount";
|
||||
|
||||
Reference in New Issue
Block a user