mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-05 17:56:49 +00:00
fix build
This commit is contained in:
@@ -1701,7 +1701,6 @@ XChainClaim::doApply()
|
||||
{
|
||||
PaymentSandbox psb(&ctx_.view());
|
||||
|
||||
AccountID const account = ctx_.tx[sfAccount];
|
||||
auto const dst = ctx_.tx[sfDestination];
|
||||
STXChainBridge const bridgeSpec = ctx_.tx[sfXChainBridge];
|
||||
STAmount const& thisChainAmount = ctx_.tx[sfAmount];
|
||||
@@ -1723,11 +1722,10 @@ XChainClaim::doApply()
|
||||
// `finalizeClaimHelper`. Since `finalizeClaimHelper` can create child
|
||||
// views, it's important that the sle's lifetime doesn't overlap.
|
||||
|
||||
AccountRoot const account(account, psb);
|
||||
auto const sleBridge = peekBridge(psb, bridgeSpec);
|
||||
auto const sleClaimID = psb.peek(claimIDKeylet);
|
||||
|
||||
if (!(sleBridge && sleClaimID && account))
|
||||
if (!(sleBridge && sleClaimID && account_))
|
||||
return Unexpected(tecINTERNAL);
|
||||
|
||||
AccountID const thisDoor = (*sleBridge)[sfAccount];
|
||||
@@ -1795,7 +1793,7 @@ XChainClaim::doApply()
|
||||
bridgeSpec,
|
||||
dst,
|
||||
dstTag,
|
||||
/*claimOwner*/ account,
|
||||
/*claimOwner*/ accountID_,
|
||||
sendingAmount,
|
||||
rewardPoolSrc,
|
||||
signatureReward,
|
||||
@@ -2173,13 +2171,11 @@ XChainCreateAccountCommit::doApply()
|
||||
{
|
||||
PaymentSandbox psb(&ctx_.view());
|
||||
|
||||
AccountID const account = ctx_.tx[sfAccount];
|
||||
STAmount const amount = ctx_.tx[sfAmount];
|
||||
STAmount const reward = ctx_.tx[sfSignatureReward];
|
||||
STXChainBridge const bridge = ctx_.tx[sfXChainBridge];
|
||||
|
||||
AccountRoot const account(account, psb);
|
||||
if (!account)
|
||||
if (!account_)
|
||||
return tecINTERNAL; // LCOV_EXCL_LINE
|
||||
|
||||
auto const sleBridge = peekBridge(psb, bridge);
|
||||
@@ -2192,7 +2188,7 @@ XChainCreateAccountCommit::doApply()
|
||||
TransferHelperSubmittingAccountInfo submittingAccountInfo{
|
||||
.account = accountID_,
|
||||
.preFeeBalance = preFeeBalance_,
|
||||
.postFeeBalance = (*account)[sfBalance]};
|
||||
.postFeeBalance = (*account_)[sfBalance]};
|
||||
STAmount const toTransfer = amount + reward;
|
||||
auto const thTer = transferHelper(
|
||||
psb,
|
||||
|
||||
@@ -87,7 +87,7 @@ CredentialDelete::doApply()
|
||||
return tefINTERNAL; // LCOV_EXCL_LINE
|
||||
|
||||
if ((subject != accountID_) && (issuer != accountID_) &&
|
||||
!checkExpired(sleCred, ctx_.view().header().parentCloseTime))
|
||||
!checkExpired(*sleCred, ctx_.view().header().parentCloseTime))
|
||||
{
|
||||
JLOG(j_.trace()) << "Can't delete non-expired credential.";
|
||||
return tecNO_PERMISSION;
|
||||
|
||||
@@ -237,7 +237,7 @@ AMMCreate::preclaim(PreclaimContext const& ctx)
|
||||
}
|
||||
|
||||
static std::pair<TER, bool>
|
||||
applyCreate(ApplyContext& ctx, Sandbox& sb, AccountID const& accountId, beast::Journal j)
|
||||
applyCreate(ApplyContext& ctx, Sandbox& sb, AccountID const& creatorAccountID, beast::Journal j)
|
||||
{
|
||||
auto const amount = ctx.tx[sfAmount];
|
||||
auto const amount2 = ctx.tx[sfAmount2];
|
||||
@@ -253,11 +253,11 @@ applyCreate(ApplyContext& ctx, Sandbox& sb, AccountID const& accountId, beast::J
|
||||
return {maybeAccount.error(), false};
|
||||
}
|
||||
auto& account = *maybeAccount;
|
||||
auto const accountId = (*account)[sfAccount];
|
||||
auto const ammAccountID = (*account)[sfAccount];
|
||||
|
||||
// LP Token already exists. (should not happen)
|
||||
auto const lptIss = ammLPTIssue(amount.asset(), amount2.asset(), accountId);
|
||||
if (sb.read(keylet::line(accountId, lptIss)))
|
||||
auto const lptIss = ammLPTIssue(amount.asset(), amount2.asset(), ammAccountID);
|
||||
if (sb.read(keylet::line(ammAccountID, lptIss)))
|
||||
{
|
||||
JLOG(j.error()) << "AMM Instance: LP Token already exists.";
|
||||
return {tecDUPLICATE, false};
|
||||
@@ -274,16 +274,16 @@ applyCreate(ApplyContext& ctx, Sandbox& sb, AccountID const& accountId, beast::J
|
||||
|
||||
// Create ltAMM
|
||||
auto ammSle = std::make_shared<SLE>(ammKeylet);
|
||||
ammSle->setAccountID(sfAccount, accountId);
|
||||
ammSle->setAccountID(sfAccount, ammAccountID);
|
||||
ammSle->setFieldAmount(sfLPTokenBalance, lpTokens);
|
||||
auto const& [asset1, asset2] = std::minmax(amount.asset(), amount2.asset());
|
||||
ammSle->setFieldIssue(sfAsset, STIssue{sfAsset, asset1});
|
||||
ammSle->setFieldIssue(sfAsset2, STIssue{sfAsset2, asset2});
|
||||
// AMM creator gets the auction slot and the voting slot.
|
||||
initializeFeeAuctionVote(ctx.view(), ammSle, accountId, lptIss, ctx.tx[sfTradingFee]);
|
||||
initializeFeeAuctionVote(ctx.view(), ammSle, creatorAccountID, lptIss, ctx.tx[sfTradingFee]);
|
||||
|
||||
// Add owner directory to link the root account and AMM object.
|
||||
if (auto ter = dirLink(sb, accountId, ammSle); ter)
|
||||
if (auto ter = dirLink(sb, ammAccountID, ammSle); ter)
|
||||
{
|
||||
JLOG(j.debug()) << "AMM Instance: failed to insert owner dir";
|
||||
return {ter, false};
|
||||
@@ -291,7 +291,7 @@ applyCreate(ApplyContext& ctx, Sandbox& sb, AccountID const& accountId, beast::J
|
||||
sb.insert(ammSle);
|
||||
|
||||
// Send LPT to LP.
|
||||
auto res = accountSend(sb, accountId, accountId, lpTokens, ctx.journal);
|
||||
auto res = accountSend(sb, ammAccountID, creatorAccountID, lpTokens, ctx.journal);
|
||||
if (!isTesSuccess(res))
|
||||
{
|
||||
JLOG(j.debug()) << "AMM Instance: failed to send LPT " << lpTokens;
|
||||
@@ -307,7 +307,7 @@ applyCreate(ApplyContext& ctx, Sandbox& sb, AccountID const& accountId, beast::J
|
||||
auto const& mptID = mptIssue.getMptID();
|
||||
std::uint32_t flags = lsfMPTAMM;
|
||||
if (auto const err =
|
||||
requireAuth(ctx.view(), mptIssue, accountId, AuthType::WeakAuth);
|
||||
requireAuth(ctx.view(), mptIssue, ammAccountID, AuthType::WeakAuth);
|
||||
!isTesSuccess(err))
|
||||
{
|
||||
if (err == tecNO_AUTH)
|
||||
@@ -320,22 +320,28 @@ applyCreate(ApplyContext& ctx, Sandbox& sb, AccountID const& accountId, beast::J
|
||||
}
|
||||
}
|
||||
|
||||
if (auto const err = createMPToken(sb, mptID, accountId, flags); !isTesSuccess(err))
|
||||
if (auto const err = createMPToken(sb, mptID, ammAccountID, flags);
|
||||
!isTesSuccess(err))
|
||||
return err;
|
||||
// Don't adjust AMM owner count.
|
||||
// It's irrelevant for pseudo-account like AMM.
|
||||
return accountSend(
|
||||
sb, accountId, accountId, amount, ctx.journal, WaiveTransferFee::Yes);
|
||||
sb, creatorAccountID, ammAccountID, amount, ctx.journal, WaiveTransferFee::Yes);
|
||||
},
|
||||
// Set AMM flag on AMM trustline
|
||||
[&](Issue const& issue) -> TER {
|
||||
if (auto const res = accountSend(
|
||||
sb, accountId, accountId, amount, ctx.journal, WaiveTransferFee::Yes))
|
||||
sb,
|
||||
creatorAccountID,
|
||||
ammAccountID,
|
||||
amount,
|
||||
ctx.journal,
|
||||
WaiveTransferFee::Yes))
|
||||
return res;
|
||||
// Set AMM flag on AMM trustline
|
||||
if (!isXRP(amount))
|
||||
{
|
||||
SLE::pointer const sleRippleState = sb.peek(keylet::line(accountId, issue));
|
||||
SLE::pointer const sleRippleState = sb.peek(keylet::line(ammAccountID, issue));
|
||||
if (!sleRippleState)
|
||||
{
|
||||
return tecINTERNAL; // LCOV_EXCL_LINE
|
||||
@@ -365,7 +371,7 @@ applyCreate(ApplyContext& ctx, Sandbox& sb, AccountID const& accountId, beast::J
|
||||
return {res, false};
|
||||
}
|
||||
|
||||
JLOG(j.debug()) << "AMM Instance: success " << accountId << " " << ammKeylet.key << " "
|
||||
JLOG(j.debug()) << "AMM Instance: success " << ammAccountID << " " << ammKeylet.key << " "
|
||||
<< lpTokens << " " << amount << " " << amount2;
|
||||
auto addOrderBook = [&](Asset const& assetIn, Asset const& assetOut, std::uint64_t uRate) {
|
||||
Book const book{assetIn, assetOut, std::nullopt};
|
||||
|
||||
@@ -1125,7 +1125,8 @@ struct Credentials_test : public beast::unit_test::Suite
|
||||
credHashes.pushBack(credKeylet.key);
|
||||
beast::Journal const j{beast::Journal::getNullSink()};
|
||||
|
||||
auto const dpTer = xrpl::verifyDepositPreauth(*stx, av, subject, becky, {}, j);
|
||||
RAccountRoot const dst(becky.id(), av, j);
|
||||
auto const dpTer = xrpl::verifyDepositPreauth(*stx, av, subject, dst, j);
|
||||
auto sleCredAfter = av.read(credKeylet);
|
||||
BEAST_EXPECT(sleCredAfter && (sleCredAfter->getFlags() & lsfAccepted));
|
||||
|
||||
|
||||
@@ -93,8 +93,8 @@ class Invariants_test : public beast::unit_test::Suite
|
||||
static FeatureBitset
|
||||
defaultAmendments()
|
||||
{
|
||||
return xrpl::test::jtx::testableAmendments() | featureInvariantsV1_1 |
|
||||
featureSingleAssetVault | fixCleanup3_1_3 | fixCleanup3_2_0;
|
||||
return xrpl::test::jtx::testableAmendments() | featureSingleAssetVault | fixCleanup3_1_3 |
|
||||
fixCleanup3_2_0;
|
||||
}
|
||||
|
||||
/** Run a specific test case to put the ledger into a state that will be
|
||||
@@ -300,8 +300,8 @@ class Invariants_test : public beast::unit_test::Suite
|
||||
{{"account deletion left behind a non-zero balance"}},
|
||||
[&](Account const& a1, Account const& a2, ApplyContext& ac) {
|
||||
// A1 has a balance. Delete A1
|
||||
auto const a1 = a1.id();
|
||||
auto const sleA1 = ac.view().peek(keylet::account(a1));
|
||||
auto const a1ID = a1.id();
|
||||
auto const sleA1 = ac.view().peek(keylet::account(a1ID));
|
||||
if (!sleA1)
|
||||
return false;
|
||||
if (!BEAST_EXPECT(*sleA1->at(sfBalance) != beast::kZERO))
|
||||
@@ -318,8 +318,8 @@ class Invariants_test : public beast::unit_test::Suite
|
||||
{{"account deletion left behind a non-zero owner count"}},
|
||||
[&](Account const& a1, Account const& a2, ApplyContext& ac) {
|
||||
// Increment A1's owner count, then delete A1
|
||||
auto const a1 = a1.id();
|
||||
WAccountRoot wrappedA1(a1, ac.view());
|
||||
auto const a1ID = a1.id();
|
||||
WAccountRoot wrappedA1(a1ID, ac.view());
|
||||
if (!wrappedA1)
|
||||
return false;
|
||||
// Clear the balance so the "account deletion left behind a
|
||||
@@ -354,12 +354,12 @@ class Invariants_test : public beast::unit_test::Suite
|
||||
[&](Account const& a1, Account const& a2, ApplyContext& ac) {
|
||||
// Add an object to the ledger for account A1, then delete
|
||||
// A1
|
||||
auto const a1 = a1.id();
|
||||
auto sleA1 = ac.view().peek(keylet::account(a1));
|
||||
auto const a1ID = a1.id();
|
||||
auto sleA1 = ac.view().peek(keylet::account(a1ID));
|
||||
if (!sleA1)
|
||||
return false;
|
||||
|
||||
auto const key = std::invoke(keyletfunc, a1);
|
||||
auto const key = std::invoke(keyletfunc, a1ID);
|
||||
auto const newSLE = std::make_shared<SLE>(key);
|
||||
ac.view().insert(newSLE);
|
||||
// Clear the balance so the "account deletion left behind a
|
||||
|
||||
Reference in New Issue
Block a user