mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-28 01:20:32 +00:00
Address my review feedback on (#6017)
- Shortcut on issuer match in canTransfer. - An asset can transfer if either trustline enabled rippling, so both must have it disabled for the transfer to fail with terNO_RIPPLE. - Remove unnecessary asfDefaultRipple sets in unit tests. - Add a new unit test helper class: testline, and a macro: THISLINE. When included as a parameter to Env::operator(), will include the line number of the transaction that didn't get the expected result. Works similarly to BEAST_EXPECT. I didn't do the same for the file name, because that can be deduced from the testcase name.
This commit is contained in:
@@ -3288,11 +3288,11 @@ canTransfer(
|
||||
return tesSUCCESS;
|
||||
|
||||
auto const issuerId = issue.getIssuer();
|
||||
if (issuerId == from || issuerId == to)
|
||||
return tesSUCCESS;
|
||||
auto const sleIssuer = view.read(keylet::account(issuerId));
|
||||
if (sleIssuer == nullptr)
|
||||
return tefINTERNAL; // LCOV_EXCL_LINE
|
||||
if (issuerId == from || issuerId == to)
|
||||
return tesSUCCESS;
|
||||
|
||||
auto const isRippleDisabled = [&](AccountID account) -> bool {
|
||||
// Line might not exist, but some transfers can create it. If this
|
||||
@@ -3306,8 +3306,8 @@ canTransfer(
|
||||
return sleIssuer->isFlag(lsfDefaultRipple) == false;
|
||||
};
|
||||
|
||||
// Fail if rippling disabled on either trust line
|
||||
if (isRippleDisabled(from) || isRippleDisabled(to))
|
||||
// Fail if rippling disabled on both trust lines
|
||||
if (isRippleDisabled(from) && isRippleDisabled(to))
|
||||
return terNO_RIPPLE;
|
||||
|
||||
return tesSUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user