From 8db3c270fb6cdba8f4362e4fc029cdd5738ad5c3 Mon Sep 17 00:00:00 2001 From: Richard Holland Date: Sat, 5 Jul 2025 10:14:20 +1000 Subject: [PATCH] experimental large ledgers with no txq --- src/ripple/app/ledger/impl/LedgerMaster.cpp | 1 + src/ripple/app/misc/impl/TxQ.cpp | 14 ++++++++------ src/ripple/basics/impl/contract.cpp | 2 +- src/ripple/ledger/impl/OpenView.cpp | 3 +++ 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/ripple/app/ledger/impl/LedgerMaster.cpp b/src/ripple/app/ledger/impl/LedgerMaster.cpp index 35f56add3..eced2ac7a 100644 --- a/src/ripple/app/ledger/impl/LedgerMaster.cpp +++ b/src/ripple/app/ledger/impl/LedgerMaster.cpp @@ -212,6 +212,7 @@ LedgerMaster::getCurrentLedgerIndex() LedgerIndex LedgerMaster::getValidLedgerIndex() { + std::cout << "getValidLedgerIndex: " << mValidLedgerSeq << "\n"; return mValidLedgerSeq; } diff --git a/src/ripple/app/misc/impl/TxQ.cpp b/src/ripple/app/misc/impl/TxQ.cpp index 8fcb0a204..5d4fb136d 100644 --- a/src/ripple/app/misc/impl/TxQ.cpp +++ b/src/ripple/app/misc/impl/TxQ.cpp @@ -745,7 +745,6 @@ TxQ::apply( // See if the transaction paid a high enough fee that it can go straight // into the ledger. - /* RHTEST view.getAndResetKeysTouched(); if (auto directApplied = tryDirectApply(app, view, tx, flags, j)) { @@ -753,7 +752,8 @@ TxQ::apply( transactionID, view.getAndResetKeysTouched()); return *directApplied; } - */ + + return {telCAN_NOT_QUEUE, false}; // If we get past tryDirectApply() without returning then we expect // one of the following to occur: @@ -1930,13 +1930,15 @@ TxQ::tryDirectApply( const bool isFirstImport = !sleAccount && view.rules().enabled(featureImport) && tx->getTxnType() == ttIMPORT; + bool const isReplayNetwork = (app.config().NETWORK_ID == 65534); + // Don't attempt to direct apply if the account is not in the ledger. - if (!sleAccount && !isFirstImport) + if (!sleAccount && !isFirstImport && !isReplayNetwork) return {}; std::optional txSeqProx; - if (!isFirstImport) + if (!isFirstImport && !isReplayNetwork) { SeqProxy const acctSeqProx = SeqProxy::sequence((*sleAccount)[sfSequence]); @@ -1949,7 +1951,7 @@ TxQ::tryDirectApply( } FeeLevel64 const requiredFeeLevel = - isFirstImport ? FeeLevel64{0} : [this, &view, flags]() { + (isFirstImport || isReplayNetwork) ? FeeLevel64{0} : [this, &view, flags]() { std::lock_guard lock(mutex_); return getRequiredFeeLevel( view, flags, feeMetrics_.getSnapshot(), lock); @@ -1959,7 +1961,7 @@ TxQ::tryDirectApply( // transaction straight into the ledger. FeeLevel64 const feeLevelPaid = getFeeLevelPaid(view, *tx); - if (feeLevelPaid >= requiredFeeLevel) + if (feeLevelPaid >= requiredFeeLevel || isReplayNetwork) { // Attempt to apply the transaction directly. auto const transactionID = tx->getTransactionID(); diff --git a/src/ripple/basics/impl/contract.cpp b/src/ripple/basics/impl/contract.cpp index bf7df6825..98a9e1fce 100644 --- a/src/ripple/basics/impl/contract.cpp +++ b/src/ripple/basics/impl/contract.cpp @@ -49,7 +49,7 @@ LogicError(std::string const& s) noexcept { JLOG(debugLog().fatal()) << s; std::cerr << "Logic error: " << s << std::endl; - detail::accessViolation(); + //detail::accessViolation(); } } // namespace ripple diff --git a/src/ripple/ledger/impl/OpenView.cpp b/src/ripple/ledger/impl/OpenView.cpp index fd03d7665..b0ba1b0ca 100644 --- a/src/ripple/ledger/impl/OpenView.cpp +++ b/src/ripple/ledger/impl/OpenView.cpp @@ -263,6 +263,9 @@ OpenView::rawTxInsert( std::shared_ptr const& txn, std::shared_ptr const& metaData) { + if (txExists(key)) + return; + auto const result = txs_.emplace( std::piecewise_construct, std::forward_as_tuple(key),