Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename allowClawback flag to allowTrustLineClawback #4617

Merged
merged 7 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/ripple/app/tx/impl/Clawback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ Clawback::preclaim(PreclaimContext const& ctx)

std::uint32_t const issuerFlagsIn = sleIssuer->getFieldU32(sfFlags);

// If AllowClawback is not set or NoFreeze is set, return no permission
if (!(issuerFlagsIn & lsfAllowClawback) || (issuerFlagsIn & lsfNoFreeze))
// If AllowTrustLineClawback is not set or NoFreeze is set, return no
// permission
if (!(issuerFlagsIn & lsfAllowTrustLineClawback) ||
(issuerFlagsIn & lsfNoFreeze))
return tecNO_PERMISSION;

auto const sleRippleState =
Expand Down
8 changes: 4 additions & 4 deletions src/ripple/app/tx/impl/SetAccount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ SetAccount::preclaim(PreclaimContext const& ctx)
//
if (ctx.view.rules().enabled(featureClawback))
{
if (uSetFlag == asfAllowClawback)
if (uSetFlag == asfAllowTrustLineClawback)
{
if (uFlagsIn & lsfNoFreeze)
{
Expand All @@ -240,7 +240,7 @@ SetAccount::preclaim(PreclaimContext const& ctx)
else if (uSetFlag == asfNoFreeze)
{
// Cannot set NoFreeze if clawback is enabled
if (uFlagsIn & lsfAllowClawback)
if (uFlagsIn & lsfAllowTrustLineClawback)
{
JLOG(ctx.j.trace())
<< "Can't set NoFreeze if clawback is enabled";
Expand Down Expand Up @@ -595,10 +595,10 @@ SetAccount::doApply()

// Set flag for clawback
if (ctx_.view().rules().enabled(featureClawback) &&
uSetFlag == asfAllowClawback)
uSetFlag == asfAllowTrustLineClawback)
{
JLOG(j_.trace()) << "set allow clawback";
uFlagsOut |= lsfAllowClawback;
uFlagsOut |= lsfAllowTrustLineClawback;
}

if (uFlagsIn != uFlagsOut)
Expand Down
4 changes: 2 additions & 2 deletions src/ripple/protocol/LedgerFormats.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ enum LedgerSpecificFlags {
lsfDisallowIncomingTrustline =
0x20000000, // True, reject new trustlines (only if no issued assets)
lsfAMM [[maybe_unused]] = 0x40000000, // True, AMM account
lsfAllowClawback =
0x80000000, // True, enable clawback
lsfAllowTrustLineClawback =
0x80000000, // True, enable clawback
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI - errant space


// ltOFFER
lsfPassive = 0x00010000,
Expand Down
2 changes: 1 addition & 1 deletion src/ripple/protocol/TxFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ constexpr std::uint32_t asfDisallowIncomingNFTokenOffer = 12;
constexpr std::uint32_t asfDisallowIncomingCheck = 13;
constexpr std::uint32_t asfDisallowIncomingPayChan = 14;
constexpr std::uint32_t asfDisallowIncomingTrustline = 15;
constexpr std::uint32_t asfAllowClawback = 16;
constexpr std::uint32_t asfAllowTrustLineClawback = 16;

// OfferCreate flags:
constexpr std::uint32_t tfPassive = 0x00010000;
Expand Down
7 changes: 4 additions & 3 deletions src/ripple/rpc/handlers/AccountInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ doAccountInfo(RPC::JsonContext& context)
{"disallowIncomingTrustline", lsfDisallowIncomingTrustline}}};

static constexpr std::pair<std::string_view, LedgerSpecificFlags>
allowClawbackFlag{"allowClawback", lsfAllowClawback};
allowTrustLineClawbackFlag{
"allowTrustLineClawback", lsfAllowTrustLineClawback};

auto const sleAccepted = ledger->read(keylet::account(accountID));
if (sleAccepted)
Expand Down Expand Up @@ -128,8 +129,8 @@ doAccountInfo(RPC::JsonContext& context)
}

if (ledger->rules().enabled(featureClawback))
acctFlags[allowClawbackFlag.first.data()] =
sleAccepted->isFlag(allowClawbackFlag.second);
acctFlags[allowTrustLineClawbackFlag.first.data()] =
sleAccepted->isFlag(allowTrustLineClawbackFlag.second);

result[jss::account_flags] = std::move(acctFlags);

Expand Down
Loading