mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Inject journals:
Calls to WriteLog are replaced with injected journals
This commit is contained in:
@@ -100,7 +100,8 @@ isFrozen (ReadView const& view, AccountID const& account,
|
||||
STAmount
|
||||
accountHolds (ReadView const& view,
|
||||
AccountID const& account, Currency const& currency,
|
||||
AccountID const& issuer, FreezeHandling zeroIfFrozen)
|
||||
AccountID const& issuer, FreezeHandling zeroIfFrozen,
|
||||
beast::Journal j)
|
||||
{
|
||||
STAmount amount;
|
||||
if (isXRP(currency))
|
||||
@@ -117,7 +118,7 @@ accountHolds (ReadView const& view,
|
||||
amount.clear ();
|
||||
else
|
||||
amount = balance - reserve;
|
||||
WriteLog (lsTRACE, View) << "accountHolds:" <<
|
||||
JLOG (j.trace) << "accountHolds:" <<
|
||||
" account=" << to_string (account) <<
|
||||
" amount=" << amount.getFullText () <<
|
||||
" balance=" << to_string (balance) <<
|
||||
@@ -147,7 +148,7 @@ accountHolds (ReadView const& view,
|
||||
}
|
||||
amount.setIssuer (issuer);
|
||||
}
|
||||
WriteLog (lsTRACE, View) << "accountHolds:" <<
|
||||
JLOG (j.trace) << "accountHolds:" <<
|
||||
" account=" << to_string (account) <<
|
||||
" amount=" << amount.getFullText ();
|
||||
}
|
||||
@@ -158,7 +159,8 @@ accountHolds (ReadView const& view,
|
||||
|
||||
STAmount
|
||||
accountFunds (ReadView const& view, AccountID const& id,
|
||||
STAmount const& saDefault, FreezeHandling freezeHandling)
|
||||
STAmount const& saDefault, FreezeHandling freezeHandling,
|
||||
beast::Journal j)
|
||||
{
|
||||
STAmount saFunds;
|
||||
|
||||
@@ -166,7 +168,7 @@ accountFunds (ReadView const& view, AccountID const& id,
|
||||
saDefault.getIssuer () == id)
|
||||
{
|
||||
saFunds = saDefault;
|
||||
WriteLog (lsTRACE, View) << "accountFunds:" <<
|
||||
JLOG (j.trace) << "accountFunds:" <<
|
||||
" account=" << to_string (id) <<
|
||||
" saDefault=" << saDefault.getFullText () <<
|
||||
" SELF-FUNDED";
|
||||
@@ -175,8 +177,8 @@ accountFunds (ReadView const& view, AccountID const& id,
|
||||
{
|
||||
saFunds = accountHolds(view, id,
|
||||
saDefault.getCurrency(), saDefault.getIssuer(),
|
||||
freezeHandling);
|
||||
WriteLog (lsTRACE, View) << "accountFunds:" <<
|
||||
freezeHandling, j);
|
||||
JLOG (j.trace) << "accountFunds:" <<
|
||||
" account=" << to_string (id) <<
|
||||
" saDefault=" << saDefault.getFullText () <<
|
||||
" saFunds=" << saFunds.getFullText ();
|
||||
@@ -416,12 +418,13 @@ cdirFirst (ReadView const& view,
|
||||
uint256 const& uRootIndex, // --> Root of directory.
|
||||
std::shared_ptr<SLE const>& sleNode, // <-> current node
|
||||
unsigned int& uDirEntry, // <-- next entry
|
||||
uint256& uEntryIndex) // <-- The entry, if available. Otherwise, zero.
|
||||
uint256& uEntryIndex, // <-- The entry, if available. Otherwise, zero.
|
||||
beast::Journal j)
|
||||
{
|
||||
sleNode = view.read(keylet::page(uRootIndex));
|
||||
uDirEntry = 0;
|
||||
assert (sleNode); // Never probe for directories.
|
||||
return cdirNext (view, uRootIndex, sleNode, uDirEntry, uEntryIndex);
|
||||
return cdirNext (view, uRootIndex, sleNode, uDirEntry, uEntryIndex, j);
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -429,7 +432,8 @@ cdirNext (ReadView const& view,
|
||||
uint256 const& uRootIndex, // --> Root of directory
|
||||
std::shared_ptr<SLE const>& sleNode, // <-> current node
|
||||
unsigned int& uDirEntry, // <-> next entry
|
||||
uint256& uEntryIndex) // <-- The entry, if available. Otherwise, zero.
|
||||
uint256& uEntryIndex, // <-- The entry, if available. Otherwise, zero.
|
||||
beast::Journal j)
|
||||
{
|
||||
auto const& svIndexes = sleNode->getFieldV256 (sfIndexes);
|
||||
assert (uDirEntry <= svIndexes.size ());
|
||||
@@ -448,17 +452,17 @@ cdirNext (ReadView const& view,
|
||||
if (!sleNext)
|
||||
{
|
||||
// This should never happen
|
||||
WriteLog (lsFATAL, View)
|
||||
JLOG (j.fatal)
|
||||
<< "Corrupt directory: index:"
|
||||
<< uRootIndex << " next:" << uNodeNext;
|
||||
return false;
|
||||
}
|
||||
sleNode = sleNext;
|
||||
return cdirNext (view, uRootIndex,
|
||||
sleNode, uDirEntry, uEntryIndex);
|
||||
sleNode, uDirEntry, uEntryIndex, j);
|
||||
}
|
||||
uEntryIndex = svIndexes[uDirEntry++];
|
||||
WriteLog (lsTRACE, View) << "dirNext:" <<
|
||||
JLOG (j.trace) << "dirNext:" <<
|
||||
" uDirEntry=" << uDirEntry <<
|
||||
" uEntryIndex=" << uEntryIndex;
|
||||
return true;
|
||||
@@ -576,7 +580,7 @@ hashOfSeq (ReadView const& ledger, LedgerIndex seq,
|
||||
void
|
||||
adjustOwnerCount (ApplyView& view,
|
||||
std::shared_ptr<SLE> const& sle,
|
||||
int amount)
|
||||
int amount, beast::Journal j)
|
||||
{
|
||||
assert(amount != 0);
|
||||
auto const current =
|
||||
@@ -587,7 +591,7 @@ adjustOwnerCount (ApplyView& view,
|
||||
// Overflow is well defined on unsigned
|
||||
if (adjusted < current)
|
||||
{
|
||||
WriteLog (lsFATAL, View) <<
|
||||
JLOG (j.fatal) <<
|
||||
"Account " << sle->getAccountID(sfAccount) <<
|
||||
" owner count exceeds max!";
|
||||
adjusted =
|
||||
@@ -599,7 +603,7 @@ adjustOwnerCount (ApplyView& view,
|
||||
// Underflow is well defined on unsigned
|
||||
if (adjusted > current)
|
||||
{
|
||||
WriteLog (lsFATAL, View) <<
|
||||
JLOG (j.fatal) <<
|
||||
"Account " << sle->getAccountID (sfAccount) <<
|
||||
" owner count set below 0!";
|
||||
adjusted = 0;
|
||||
@@ -615,12 +619,13 @@ dirFirst (ApplyView& view,
|
||||
uint256 const& uRootIndex, // --> Root of directory.
|
||||
std::shared_ptr<SLE>& sleNode, // <-> current node
|
||||
unsigned int& uDirEntry, // <-- next entry
|
||||
uint256& uEntryIndex) // <-- The entry, if available. Otherwise, zero.
|
||||
uint256& uEntryIndex, // <-- The entry, if available. Otherwise, zero.
|
||||
beast::Journal j)
|
||||
{
|
||||
sleNode = view.peek(keylet::page(uRootIndex));
|
||||
uDirEntry = 0;
|
||||
assert (sleNode); // Never probe for directories.
|
||||
return dirNext (view, uRootIndex, sleNode, uDirEntry, uEntryIndex);
|
||||
return dirNext (view, uRootIndex, sleNode, uDirEntry, uEntryIndex, j);
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -628,7 +633,8 @@ dirNext (ApplyView& view,
|
||||
uint256 const& uRootIndex, // --> Root of directory
|
||||
std::shared_ptr<SLE>& sleNode, // <-> current node
|
||||
unsigned int& uDirEntry, // <-> next entry
|
||||
uint256& uEntryIndex) // <-- The entry, if available. Otherwise, zero.
|
||||
uint256& uEntryIndex, // <-- The entry, if available. Otherwise, zero.
|
||||
beast::Journal j)
|
||||
{
|
||||
auto const& svIndexes = sleNode->getFieldV256 (sfIndexes);
|
||||
assert (uDirEntry <= svIndexes.size ());
|
||||
@@ -647,17 +653,17 @@ dirNext (ApplyView& view,
|
||||
if (!sleNext)
|
||||
{
|
||||
// This should never happen
|
||||
WriteLog (lsFATAL, View)
|
||||
JLOG (j.fatal)
|
||||
<< "Corrupt directory: index:"
|
||||
<< uRootIndex << " next:" << uNodeNext;
|
||||
return false;
|
||||
}
|
||||
sleNode = sleNext;
|
||||
return dirNext (view, uRootIndex,
|
||||
sleNode, uDirEntry, uEntryIndex);
|
||||
sleNode, uDirEntry, uEntryIndex, j);
|
||||
}
|
||||
uEntryIndex = svIndexes[uDirEntry++];
|
||||
WriteLog (lsTRACE, View) << "dirNext:" <<
|
||||
JLOG (j.trace) << "dirNext:" <<
|
||||
" uDirEntry=" << uDirEntry <<
|
||||
" uEntryIndex=" << uEntryIndex;
|
||||
return true;
|
||||
@@ -677,9 +683,10 @@ dirAdd (ApplyView& view,
|
||||
std::uint64_t& uNodeDir,
|
||||
uint256 const& uRootIndex, // VFALCO Should be Keylet
|
||||
uint256 const& uLedgerIndex,
|
||||
std::function<void (SLE::ref, bool)> fDescriber)
|
||||
std::function<void (SLE::ref, bool)> fDescriber,
|
||||
beast::Journal j)
|
||||
{
|
||||
WriteLog (lsTRACE, View) << "dirAdd:" <<
|
||||
JLOG (j.trace) << "dirAdd:" <<
|
||||
" uRootIndex=" << to_string (uRootIndex) <<
|
||||
" uLedgerIndex=" << to_string (uLedgerIndex);
|
||||
|
||||
@@ -755,11 +762,11 @@ dirAdd (ApplyView& view,
|
||||
svIndexes.push_back (uLedgerIndex); // Append entry.
|
||||
sleNode->setFieldV256 (sfIndexes, svIndexes); // Save entry.
|
||||
|
||||
WriteLog (lsTRACE, View) <<
|
||||
JLOG (j.trace) <<
|
||||
"dirAdd: creating: root: " << to_string (uRootIndex);
|
||||
WriteLog (lsTRACE, View) <<
|
||||
JLOG (j.trace) <<
|
||||
"dirAdd: appending: Entry: " << to_string (uLedgerIndex);
|
||||
WriteLog (lsTRACE, View) <<
|
||||
JLOG (j.trace) <<
|
||||
"dirAdd: appending: Node: " << strHex (uNodeDir);
|
||||
|
||||
return tesSUCCESS;
|
||||
@@ -773,7 +780,8 @@ dirDelete (ApplyView& view,
|
||||
uint256 const& uRootIndex, // --> The index of the base of the directory. Nodes are based off of this.
|
||||
uint256 const& uLedgerIndex, // --> Value to remove from directory.
|
||||
const bool bStable, // --> True, not to change relative order of entries.
|
||||
const bool bSoft) // --> True, uNodeDir is not hard and fast (pass uNodeDir=0).
|
||||
const bool bSoft, // --> True, uNodeDir is not hard and fast (pass uNodeDir=0).
|
||||
beast::Journal j)
|
||||
{
|
||||
std::uint64_t uNodeCur = uNodeDir;
|
||||
SLE::pointer sleNode =
|
||||
@@ -781,7 +789,7 @@ dirDelete (ApplyView& view,
|
||||
|
||||
if (!sleNode)
|
||||
{
|
||||
WriteLog (lsWARNING, View) << "dirDelete: no such node:" <<
|
||||
JLOG (j.warning) << "dirDelete: no such node:" <<
|
||||
" uRootIndex=" << to_string (uRootIndex) <<
|
||||
" uNodeDir=" << strHex (uNodeDir) <<
|
||||
" uLedgerIndex=" << to_string (uLedgerIndex);
|
||||
@@ -796,7 +804,7 @@ dirDelete (ApplyView& view,
|
||||
// Go the extra mile. Even if node doesn't exist, try the next node.
|
||||
|
||||
return dirDelete (view, bKeepRoot,
|
||||
uNodeDir + 1, uRootIndex, uLedgerIndex, bStable, true);
|
||||
uNodeDir + 1, uRootIndex, uLedgerIndex, bStable, true, j);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -813,7 +821,7 @@ dirDelete (ApplyView& view,
|
||||
if (!bSoft)
|
||||
{
|
||||
assert (false);
|
||||
WriteLog (lsWARNING, View) << "dirDelete: no such entry";
|
||||
JLOG (j.warning) << "dirDelete: no such entry";
|
||||
return tefBAD_LEDGER;
|
||||
}
|
||||
|
||||
@@ -821,7 +829,7 @@ dirDelete (ApplyView& view,
|
||||
{
|
||||
// Go the extra mile. Even if entry not in node, try the next node.
|
||||
return dirDelete (view, bKeepRoot, uNodeDir + 1,
|
||||
uRootIndex, uLedgerIndex, bStable, true);
|
||||
uRootIndex, uLedgerIndex, bStable, true, j);
|
||||
}
|
||||
|
||||
return tefBAD_LEDGER;
|
||||
@@ -903,13 +911,13 @@ dirDelete (ApplyView& view,
|
||||
assert (slePrevious);
|
||||
if (!slePrevious)
|
||||
{
|
||||
WriteLog (lsWARNING, View) << "dirDelete: previous node is missing";
|
||||
JLOG (j.warning) << "dirDelete: previous node is missing";
|
||||
return tefBAD_LEDGER;
|
||||
}
|
||||
assert (sleNext);
|
||||
if (!sleNext)
|
||||
{
|
||||
WriteLog (lsWARNING, View) << "dirDelete: next node is missing";
|
||||
JLOG (j.warning) << "dirDelete: next node is missing";
|
||||
return tefBAD_LEDGER;
|
||||
}
|
||||
|
||||
@@ -968,9 +976,10 @@ trustCreate (ApplyView& view,
|
||||
STAmount const& saLimit, // --> limit for account being set.
|
||||
// Issuer should be the account being set.
|
||||
std::uint32_t uQualityIn,
|
||||
std::uint32_t uQualityOut)
|
||||
std::uint32_t uQualityOut,
|
||||
beast::Journal j)
|
||||
{
|
||||
WriteLog (lsTRACE, View)
|
||||
JLOG (j.trace)
|
||||
<< "trustCreate: " << to_string (uSrcAccountID) << ", "
|
||||
<< to_string (uDstAccountID) << ", " << saBalance.getFullText ();
|
||||
|
||||
@@ -991,7 +1000,8 @@ trustCreate (ApplyView& view,
|
||||
[uLowAccountID](std::shared_ptr<SLE> const& sle, bool)
|
||||
{
|
||||
sle->setAccountID (sfOwner, uLowAccountID);
|
||||
});
|
||||
},
|
||||
j);
|
||||
|
||||
if (tesSUCCESS == terResult)
|
||||
{
|
||||
@@ -1002,7 +1012,8 @@ trustCreate (ApplyView& view,
|
||||
[uHighAccountID](std::shared_ptr<SLE> const& sle, bool)
|
||||
{
|
||||
sle->setAccountID (sfOwner, uHighAccountID);
|
||||
});
|
||||
},
|
||||
j);
|
||||
}
|
||||
|
||||
if (tesSUCCESS == terResult)
|
||||
@@ -1057,7 +1068,7 @@ trustCreate (ApplyView& view,
|
||||
}
|
||||
|
||||
sleRippleState->setFieldU32 (sfFlags, uFlags);
|
||||
adjustOwnerCount(view, sleAccount, 1);
|
||||
adjustOwnerCount(view, sleAccount, 1, j);
|
||||
|
||||
// ONLY: Create ripple balance.
|
||||
sleRippleState->setFieldAmount (sfBalance, bSetHigh ? -saBalance : saBalance);
|
||||
@@ -1073,7 +1084,8 @@ TER
|
||||
trustDelete (ApplyView& view,
|
||||
std::shared_ptr<SLE> const& sleRippleState,
|
||||
AccountID const& uLowAccountID,
|
||||
AccountID const& uHighAccountID)
|
||||
AccountID const& uHighAccountID,
|
||||
beast::Journal j)
|
||||
{
|
||||
// Detect legacy dirs.
|
||||
bool bLowNode = sleRippleState->isFieldPresent (sfLowNode);
|
||||
@@ -1082,7 +1094,7 @@ trustDelete (ApplyView& view,
|
||||
std::uint64_t uHighNode = sleRippleState->getFieldU64 (sfHighNode);
|
||||
TER terResult;
|
||||
|
||||
WriteLog (lsTRACE, View)
|
||||
JLOG (j.trace)
|
||||
<< "trustDelete: Deleting ripple line: low";
|
||||
terResult = dirDelete(view,
|
||||
false,
|
||||
@@ -1090,11 +1102,12 @@ trustDelete (ApplyView& view,
|
||||
getOwnerDirIndex (uLowAccountID),
|
||||
sleRippleState->getIndex (),
|
||||
false,
|
||||
!bLowNode);
|
||||
!bLowNode,
|
||||
j);
|
||||
|
||||
if (tesSUCCESS == terResult)
|
||||
{
|
||||
WriteLog (lsTRACE, View)
|
||||
JLOG (j.trace)
|
||||
<< "trustDelete: Deleting ripple line: high";
|
||||
terResult = dirDelete (view,
|
||||
false,
|
||||
@@ -1102,10 +1115,11 @@ trustDelete (ApplyView& view,
|
||||
getOwnerDirIndex (uHighAccountID),
|
||||
sleRippleState->getIndex (),
|
||||
false,
|
||||
!bHighNode);
|
||||
!bHighNode,
|
||||
j);
|
||||
}
|
||||
|
||||
WriteLog (lsTRACE, View) << "trustDelete: Deleting ripple line: state";
|
||||
JLOG (j.trace) << "trustDelete: Deleting ripple line: state";
|
||||
view.erase(sleRippleState);
|
||||
|
||||
return terResult;
|
||||
@@ -1113,7 +1127,8 @@ trustDelete (ApplyView& view,
|
||||
|
||||
TER
|
||||
offerDelete (ApplyView& view,
|
||||
std::shared_ptr<SLE> const& sle)
|
||||
std::shared_ptr<SLE> const& sle,
|
||||
beast::Journal j)
|
||||
{
|
||||
if (! sle)
|
||||
return tesSUCCESS;
|
||||
@@ -1127,13 +1142,13 @@ offerDelete (ApplyView& view,
|
||||
std::uint64_t uBookNode = sle->getFieldU64 (sfBookNode);
|
||||
|
||||
TER terResult = dirDelete (view, false, uOwnerNode,
|
||||
getOwnerDirIndex (owner), offerIndex, false, !bOwnerNode);
|
||||
getOwnerDirIndex (owner), offerIndex, false, !bOwnerNode, j);
|
||||
TER terResult2 = dirDelete (view, false, uBookNode,
|
||||
uDirectory, offerIndex, true, false);
|
||||
uDirectory, offerIndex, true, false, j);
|
||||
|
||||
if (tesSUCCESS == terResult)
|
||||
adjustOwnerCount(view, view.peek(
|
||||
keylet::account(owner)), -1);
|
||||
keylet::account(owner)), -1, j);
|
||||
|
||||
view.erase(sle);
|
||||
|
||||
@@ -1148,7 +1163,8 @@ offerDelete (ApplyView& view,
|
||||
TER
|
||||
rippleCredit (ApplyView& view,
|
||||
AccountID const& uSenderID, AccountID const& uReceiverID,
|
||||
STAmount const& saAmount, bool bCheckIssuer)
|
||||
STAmount const& saAmount, bool bCheckIssuer,
|
||||
beast::Journal j)
|
||||
{
|
||||
auto issuer = saAmount.getIssuer ();
|
||||
auto currency = saAmount.getCurrency ();
|
||||
@@ -1178,7 +1194,7 @@ rippleCredit (ApplyView& view,
|
||||
|
||||
saBalance.setIssuer (noAccount());
|
||||
|
||||
WriteLog (lsDEBUG, View) << "rippleCredit: "
|
||||
JLOG (j.debug) << "rippleCredit: "
|
||||
"create line: " << to_string (uSenderID) <<
|
||||
" -> " << to_string (uReceiverID) <<
|
||||
" : " << saAmount.getFullText ();
|
||||
@@ -1200,7 +1216,8 @@ rippleCredit (ApplyView& view,
|
||||
saBalance,
|
||||
saReceiverLimit,
|
||||
0,
|
||||
0);
|
||||
0,
|
||||
j);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1216,7 +1233,7 @@ rippleCredit (ApplyView& view,
|
||||
|
||||
saBalance -= saAmount;
|
||||
|
||||
WriteLog (lsTRACE, View) << "rippleCredit: " <<
|
||||
JLOG (j.trace) << "rippleCredit: " <<
|
||||
to_string (uSenderID) <<
|
||||
" -> " << to_string (uReceiverID) <<
|
||||
" : before=" << saBefore.getFullText () <<
|
||||
@@ -1248,7 +1265,7 @@ rippleCredit (ApplyView& view,
|
||||
{
|
||||
// Clear the reserve of the sender, possibly delete the line!
|
||||
adjustOwnerCount(view,
|
||||
view.peek(keylet::account(uSenderID)), -1);
|
||||
view.peek(keylet::account(uSenderID)), -1, j);
|
||||
|
||||
// Clear reserve flag.
|
||||
sleRippleState->setFieldU32 (
|
||||
@@ -1273,7 +1290,7 @@ rippleCredit (ApplyView& view,
|
||||
terResult = trustDelete (view,
|
||||
sleRippleState,
|
||||
bSenderHigh ? uReceiverID : uSenderID,
|
||||
!bSenderHigh ? uReceiverID : uSenderID);
|
||||
!bSenderHigh ? uReceiverID : uSenderID, j);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1292,7 +1309,8 @@ rippleTransferFee (ReadView const& view,
|
||||
AccountID const& from,
|
||||
AccountID const& to,
|
||||
AccountID const& issuer,
|
||||
STAmount const& saAmount)
|
||||
STAmount const& saAmount,
|
||||
beast::Journal j)
|
||||
{
|
||||
if (from != issuer && to != issuer)
|
||||
{
|
||||
@@ -1304,7 +1322,7 @@ rippleTransferFee (ReadView const& view,
|
||||
saAmount, amountFromRate (uTransitRate), saAmount.issue ());
|
||||
STAmount saTransferFee = saTransferTotal - saAmount;
|
||||
|
||||
WriteLog (lsDEBUG, View) << "rippleTransferFee:" <<
|
||||
JLOG (j.debug) << "rippleTransferFee:" <<
|
||||
" saTransferFee=" << saTransferFee.getFullText ();
|
||||
|
||||
return saTransferFee;
|
||||
@@ -1321,7 +1339,7 @@ static
|
||||
TER
|
||||
rippleSend (ApplyView& view,
|
||||
AccountID const& uSenderID, AccountID const& uReceiverID,
|
||||
STAmount const& saAmount, STAmount& saActual)
|
||||
STAmount const& saAmount, STAmount& saActual, beast::Journal j)
|
||||
{
|
||||
auto const issuer = saAmount.getIssuer ();
|
||||
TER terResult;
|
||||
@@ -1333,7 +1351,7 @@ rippleSend (ApplyView& view,
|
||||
{
|
||||
// VFALCO Why do we need this bCheckIssuer?
|
||||
// Direct send: redeeming IOUs and/or sending own IOUs.
|
||||
terResult = rippleCredit (view, uSenderID, uReceiverID, saAmount, false);
|
||||
terResult = rippleCredit (view, uSenderID, uReceiverID, saAmount, false, j);
|
||||
saActual = saAmount;
|
||||
terResult = tesSUCCESS;
|
||||
}
|
||||
@@ -1342,23 +1360,23 @@ rippleSend (ApplyView& view,
|
||||
// Sending 3rd party IOUs: transit.
|
||||
|
||||
STAmount saTransitFee = rippleTransferFee (view,
|
||||
uSenderID, uReceiverID, issuer, saAmount);
|
||||
uSenderID, uReceiverID, issuer, saAmount, j);
|
||||
|
||||
saActual = !saTransitFee ? saAmount : saAmount + saTransitFee;
|
||||
|
||||
saActual.setIssuer (issuer); // XXX Make sure this done in + above.
|
||||
|
||||
WriteLog (lsDEBUG, View) << "rippleSend> " <<
|
||||
JLOG (j.debug) << "rippleSend> " <<
|
||||
to_string (uSenderID) <<
|
||||
" - > " << to_string (uReceiverID) <<
|
||||
" : deliver=" << saAmount.getFullText () <<
|
||||
" fee=" << saTransitFee.getFullText () <<
|
||||
" cost=" << saActual.getFullText ();
|
||||
|
||||
terResult = rippleCredit (view, issuer, uReceiverID, saAmount, true);
|
||||
terResult = rippleCredit (view, issuer, uReceiverID, saAmount, true, j);
|
||||
|
||||
if (tesSUCCESS == terResult)
|
||||
terResult = rippleCredit (view, uSenderID, issuer, saActual, true);
|
||||
terResult = rippleCredit (view, uSenderID, issuer, saActual, true, j);
|
||||
}
|
||||
|
||||
return terResult;
|
||||
@@ -1367,7 +1385,7 @@ rippleSend (ApplyView& view,
|
||||
TER
|
||||
accountSend (ApplyView& view,
|
||||
AccountID const& uSenderID, AccountID const& uReceiverID,
|
||||
STAmount const& saAmount)
|
||||
STAmount const& saAmount, beast::Journal j)
|
||||
{
|
||||
assert (saAmount >= zero);
|
||||
|
||||
@@ -1381,11 +1399,11 @@ accountSend (ApplyView& view,
|
||||
{
|
||||
STAmount saActual;
|
||||
|
||||
WriteLog (lsTRACE, View) << "accountSend: " <<
|
||||
JLOG (j.trace) << "accountSend: " <<
|
||||
to_string (uSenderID) << " -> " << to_string (uReceiverID) <<
|
||||
" : " << saAmount.getFullText ();
|
||||
|
||||
return rippleSend (view, uSenderID, uReceiverID, saAmount, saActual);
|
||||
return rippleSend (view, uSenderID, uReceiverID, saAmount, saActual, j);
|
||||
}
|
||||
|
||||
view.creditHook (uSenderID,
|
||||
@@ -1417,7 +1435,7 @@ accountSend (ApplyView& view,
|
||||
if (receiver)
|
||||
receiver_bal = receiver->getFieldAmount (sfBalance).getFullText ();
|
||||
|
||||
WriteLog (lsTRACE, View) << "accountSend> " <<
|
||||
JLOG (j.trace) << "accountSend> " <<
|
||||
to_string (uSenderID) << " (" << sender_bal <<
|
||||
") -> " << to_string (uReceiverID) << " (" << receiver_bal <<
|
||||
") : " << saAmount.getFullText ();
|
||||
@@ -1461,7 +1479,7 @@ accountSend (ApplyView& view,
|
||||
if (receiver)
|
||||
receiver_bal = receiver->getFieldAmount (sfBalance).getFullText ();
|
||||
|
||||
WriteLog (lsTRACE, View) << "accountSend< " <<
|
||||
JLOG (j.trace) << "accountSend< " <<
|
||||
to_string (uSenderID) << " (" << sender_bal <<
|
||||
") -> " << to_string (uReceiverID) << " (" << receiver_bal <<
|
||||
") : " << saAmount.getFullText ();
|
||||
@@ -1478,7 +1496,8 @@ updateTrustLine (
|
||||
bool bSenderHigh,
|
||||
AccountID const& sender,
|
||||
STAmount const& before,
|
||||
STAmount const& after)
|
||||
STAmount const& after,
|
||||
beast::Journal j)
|
||||
{
|
||||
std::uint32_t const flags (state->getFieldU32 (sfFlags));
|
||||
|
||||
@@ -1507,7 +1526,7 @@ updateTrustLine (
|
||||
{
|
||||
// VFALCO Where is the line being deleted?
|
||||
// Clear the reserve of the sender, possibly delete the line!
|
||||
adjustOwnerCount(view, sle, -1);
|
||||
adjustOwnerCount(view, sle, -1, j);
|
||||
|
||||
// Clear reserve flag.
|
||||
state->setFieldU32 (sfFlags,
|
||||
@@ -1525,7 +1544,7 @@ updateTrustLine (
|
||||
TER
|
||||
issueIOU (ApplyView& view,
|
||||
AccountID const& account,
|
||||
STAmount const& amount, Issue const& issue)
|
||||
STAmount const& amount, Issue const& issue, beast::Journal j)
|
||||
{
|
||||
assert (!isXRP (account) && !isXRP (issue.account));
|
||||
|
||||
@@ -1535,7 +1554,7 @@ issueIOU (ApplyView& view,
|
||||
// Can't send to self!
|
||||
assert (issue.account != account);
|
||||
|
||||
WriteLog (lsTRACE, View) << "issueIOU: " <<
|
||||
JLOG (j.trace) << "issueIOU: " <<
|
||||
to_string (account) << ": " <<
|
||||
amount.getFullText ();
|
||||
|
||||
@@ -1559,7 +1578,7 @@ issueIOU (ApplyView& view,
|
||||
bool noRipple = (receiverAccount->getFlags() & lsfDefaultRipple) == 0;
|
||||
|
||||
return trustCreate (view, bSenderHigh, issue.account, account, index,
|
||||
receiverAccount, false, noRipple, false, final_balance, limit, 0, 0);
|
||||
receiverAccount, false, noRipple, false, final_balance, limit, 0, 0, j);
|
||||
}
|
||||
|
||||
STAmount final_balance = state->getFieldAmount (sfBalance);
|
||||
@@ -1572,7 +1591,7 @@ issueIOU (ApplyView& view,
|
||||
final_balance -= amount;
|
||||
|
||||
auto const must_delete = updateTrustLine(view, state, bSenderHigh, issue.account,
|
||||
start_balance, final_balance);
|
||||
start_balance, final_balance, j);
|
||||
|
||||
if (bSenderHigh)
|
||||
final_balance.negate ();
|
||||
@@ -1587,7 +1606,7 @@ issueIOU (ApplyView& view,
|
||||
if (must_delete)
|
||||
return trustDelete (view, state,
|
||||
bSenderHigh ? account : issue.account,
|
||||
bSenderHigh ? issue.account : account);
|
||||
bSenderHigh ? issue.account : account, j);
|
||||
|
||||
view.update (state);
|
||||
|
||||
@@ -1598,7 +1617,8 @@ TER
|
||||
redeemIOU (ApplyView& view,
|
||||
AccountID const& account,
|
||||
STAmount const& amount,
|
||||
Issue const& issue)
|
||||
Issue const& issue,
|
||||
beast::Journal j)
|
||||
{
|
||||
assert (!isXRP (account) && !isXRP (issue.account));
|
||||
|
||||
@@ -1608,7 +1628,7 @@ redeemIOU (ApplyView& view,
|
||||
// Can't send to self!
|
||||
assert (issue.account != account);
|
||||
|
||||
WriteLog (lsTRACE, View) << "redeemIOU: " <<
|
||||
JLOG (j.trace) << "redeemIOU: " <<
|
||||
to_string (account) << ": " <<
|
||||
amount.getFullText ();
|
||||
|
||||
@@ -1622,7 +1642,7 @@ redeemIOU (ApplyView& view,
|
||||
// In order to hold an IOU, a trust line *MUST* exist to track the
|
||||
// balance. If it doesn't, then something is very wrong. Don't try
|
||||
// to continue.
|
||||
WriteLog (lsFATAL, View) << "redeemIOU: " <<
|
||||
JLOG (j.fatal) << "redeemIOU: " <<
|
||||
to_string (account) << " attempts to redeem " <<
|
||||
amount.getFullText () << " but no trust line exists!";
|
||||
|
||||
@@ -1639,7 +1659,7 @@ redeemIOU (ApplyView& view,
|
||||
final_balance -= amount;
|
||||
|
||||
auto const must_delete = updateTrustLine (view, state, bSenderHigh, account,
|
||||
start_balance, final_balance);
|
||||
start_balance, final_balance, j);
|
||||
|
||||
if (bSenderHigh)
|
||||
final_balance.negate ();
|
||||
@@ -1656,7 +1676,7 @@ redeemIOU (ApplyView& view,
|
||||
{
|
||||
return trustDelete (view, state,
|
||||
bSenderHigh ? issue.account : account,
|
||||
bSenderHigh ? account : issue.account);
|
||||
bSenderHigh ? account : issue.account, j);
|
||||
}
|
||||
|
||||
view.update (state);
|
||||
@@ -1667,7 +1687,8 @@ TER
|
||||
transferXRP (ApplyView& view,
|
||||
AccountID const& from,
|
||||
AccountID const& to,
|
||||
STAmount const& amount)
|
||||
STAmount const& amount,
|
||||
beast::Journal j)
|
||||
{
|
||||
assert (from != beast::zero);
|
||||
assert (to != beast::zero);
|
||||
@@ -1677,7 +1698,7 @@ transferXRP (ApplyView& view,
|
||||
SLE::pointer sender = view.peek (keylet::account(from));
|
||||
SLE::pointer receiver = view.peek (keylet::account(to));
|
||||
|
||||
WriteLog (lsTRACE, View) << "transferXRP: " <<
|
||||
JLOG (j.trace) << "transferXRP: " <<
|
||||
to_string (from) << " -> " << to_string (to) <<
|
||||
") : " << amount.getFullText ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user