fix(ledger): preserve parent context during live apply

This commit is contained in:
Nicholas Dudfield
2026-07-16 18:20:43 +07:00
parent e5d62430fb
commit 4eee7c46cb
2 changed files with 5 additions and 8 deletions

View File

@@ -100,6 +100,7 @@ buildLedgerImpl(
std::size_t
applyTransactions(
Application& app,
std::shared_ptr<Ledger const> const& parent,
std::shared_ptr<Ledger const> const& built,
CanonicalTXSet& txns,
std::set<TxID>& failed,
@@ -109,7 +110,7 @@ applyTransactions(
bool certainRetry = true;
std::size_t count = 0;
ApplyOptions const applyOptions{};
ApplyOptions const applyOptions{parent};
//@@start rng-entropy-first-application
// CRITICAL: Apply consensus entropy pseudo-tx FIRST before any other
@@ -257,8 +258,8 @@ buildLedger(
JLOG(j.debug())
<< "Attempting to apply " << txns.size() << " transactions";
auto const applied =
applyTransactions(app, built, txns, failedTxns, accum, j);
auto const applied = applyTransactions(
app, parent, built, txns, failedTxns, accum, j);
if (!txns.empty() || !failedTxns.empty())
JLOG(j.debug()) << "Applied " << applied << " transactions; "

View File

@@ -19,7 +19,6 @@
#include <xrpld/app/hook/applyHook.h>
#include <xrpld/app/ledger/Ledger.h>
#include <xrpld/app/ledger/LedgerMaster.h>
#include <xrpld/app/main/Application.h>
#include <xrpld/app/misc/AmendmentTable.h>
#include <xrpld/app/misc/NetworkOPs.h>
@@ -379,10 +378,7 @@ Change::applyExportSignatures()
auto const account = signingPayload->getAccountID(sfAccount);
auto const latchKey = keylet::exportLatch(account, origin);
auto parent = ctx_.replayParentLedger();
if (!parent)
parent = ctx_.app.getLedgerMaster().getLedgerByHash(
view().info().parentHash);
auto const parent = ctx_.replayParentLedger();
if (!parent || parent->info().hash != view().info().parentHash)
return tefBAD_LEDGER;