mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
fix: add allowTrustLineLocking flag for account_info (#5525)
* Update the `account_info` API so that the `allowTrustLineLocking` flag is included in the response. * The proposed `TokenEscrow` amendment added an `allowTrustLineLocking` flag in the `AccountRoot` object. * In the API response, under `account_flags`, there is now an `allowTrustLineLocking` field with a boolean (`true` or `false`) value. * For reference, the XLS-85 Token-Enabled Escrows implementation can be found in https://github.com/XRPLF/rippled/pull/5185
This commit is contained in:
@@ -675,6 +675,30 @@ public:
|
|||||||
BEAST_EXPECT(
|
BEAST_EXPECT(
|
||||||
!getAccountFlag(allowTrustLineClawbackFlag.first, bob));
|
!getAccountFlag(allowTrustLineClawbackFlag.first, bob));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static constexpr std::pair<std::string_view, std::uint32_t>
|
||||||
|
allowTrustLineLockingFlag{
|
||||||
|
"allowTrustLineLocking", asfAllowTrustLineLocking};
|
||||||
|
|
||||||
|
if (features[featureTokenEscrow])
|
||||||
|
{
|
||||||
|
auto const f1 =
|
||||||
|
getAccountFlag(allowTrustLineLockingFlag.first, bob);
|
||||||
|
BEAST_EXPECT(f1.has_value());
|
||||||
|
BEAST_EXPECT(!f1.value());
|
||||||
|
|
||||||
|
// Set allowTrustLineLocking
|
||||||
|
env(fset(bob, allowTrustLineLockingFlag.second));
|
||||||
|
env.close();
|
||||||
|
auto const f2 =
|
||||||
|
getAccountFlag(allowTrustLineLockingFlag.first, bob);
|
||||||
|
BEAST_EXPECT(f2.has_value());
|
||||||
|
BEAST_EXPECT(f2.value());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BEAST_EXPECT(!getAccountFlag(allowTrustLineLockingFlag.first, bob));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -691,6 +715,9 @@ public:
|
|||||||
testAccountFlags(allFeatures - featureDisallowIncoming);
|
testAccountFlags(allFeatures - featureDisallowIncoming);
|
||||||
testAccountFlags(
|
testAccountFlags(
|
||||||
allFeatures - featureDisallowIncoming - featureClawback);
|
allFeatures - featureDisallowIncoming - featureClawback);
|
||||||
|
testAccountFlags(
|
||||||
|
allFeatures - featureDisallowIncoming - featureClawback -
|
||||||
|
featureTokenEscrow);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -108,6 +108,10 @@ doAccountInfo(RPC::JsonContext& context)
|
|||||||
allowTrustLineClawbackFlag{
|
allowTrustLineClawbackFlag{
|
||||||
"allowTrustLineClawback", lsfAllowTrustLineClawback};
|
"allowTrustLineClawback", lsfAllowTrustLineClawback};
|
||||||
|
|
||||||
|
static constexpr std::pair<std::string_view, LedgerSpecificFlags>
|
||||||
|
allowTrustLineLockingFlag{
|
||||||
|
"allowTrustLineLocking", lsfAllowTrustLineLocking};
|
||||||
|
|
||||||
auto const sleAccepted = ledger->read(keylet::account(accountID));
|
auto const sleAccepted = ledger->read(keylet::account(accountID));
|
||||||
if (sleAccepted)
|
if (sleAccepted)
|
||||||
{
|
{
|
||||||
@@ -140,6 +144,10 @@ doAccountInfo(RPC::JsonContext& context)
|
|||||||
acctFlags[allowTrustLineClawbackFlag.first.data()] =
|
acctFlags[allowTrustLineClawbackFlag.first.data()] =
|
||||||
sleAccepted->isFlag(allowTrustLineClawbackFlag.second);
|
sleAccepted->isFlag(allowTrustLineClawbackFlag.second);
|
||||||
|
|
||||||
|
if (ledger->rules().enabled(featureTokenEscrow))
|
||||||
|
acctFlags[allowTrustLineLockingFlag.first.data()] =
|
||||||
|
sleAccepted->isFlag(allowTrustLineLockingFlag.second);
|
||||||
|
|
||||||
result[jss::account_flags] = std::move(acctFlags);
|
result[jss::account_flags] = std::move(acctFlags);
|
||||||
|
|
||||||
// The document[https://xrpl.org/account_info.html#account_info] states
|
// The document[https://xrpl.org/account_info.html#account_info] states
|
||||||
|
|||||||
Reference in New Issue
Block a user