From 372f25d09b8de70ee850a58160053acc6da9f790 Mon Sep 17 00:00:00 2001 From: tequ Date: Thu, 24 Apr 2025 15:38:14 +0900 Subject: [PATCH] Remove #ifndef DEBUG guards and exception handling wrappers (#496) --- src/ripple/app/consensus/RCLConsensus.cpp | 5 ----- src/ripple/app/ledger/impl/BuildLedger.cpp | 4 ---- src/ripple/app/tx/impl/apply.cpp | 4 ---- src/ripple/app/tx/impl/applySteps.cpp | 12 ------------ 4 files changed, 25 deletions(-) diff --git a/src/ripple/app/consensus/RCLConsensus.cpp b/src/ripple/app/consensus/RCLConsensus.cpp index 681645606..4fb0c5275 100644 --- a/src/ripple/app/consensus/RCLConsensus.cpp +++ b/src/ripple/app/consensus/RCLConsensus.cpp @@ -498,15 +498,11 @@ RCLConsensus::Adaptor::doAccept( for (auto const& item : *result.txns.map_) { -#ifndef DEBUG try { -#endif retriableTxs.insert( std::make_shared(SerialIter{item.slice()})); JLOG(j_.debug()) << " Tx: " << item.key(); - -#ifndef DEBUG } catch (std::exception const& ex) { @@ -514,7 +510,6 @@ RCLConsensus::Adaptor::doAccept( JLOG(j_.warn()) << " Tx: " << item.key() << " throws: " << ex.what(); } -#endif } auto built = buildLCL( diff --git a/src/ripple/app/ledger/impl/BuildLedger.cpp b/src/ripple/app/ledger/impl/BuildLedger.cpp index fbdf9945f..56feda066 100644 --- a/src/ripple/app/ledger/impl/BuildLedger.cpp +++ b/src/ripple/app/ledger/impl/BuildLedger.cpp @@ -116,10 +116,8 @@ applyTransactions( { auto const txid = it->first.getTXID(); -#ifndef DEBUG try { -#endif if (pass == 0 && built->txExists(txid)) { it = txns.erase(it); @@ -142,7 +140,6 @@ applyTransactions( case ApplyResult::Retry: ++it; } -#ifndef DEBUG } catch (std::exception const& ex) { @@ -151,7 +148,6 @@ applyTransactions( failed.insert(txid); it = txns.erase(it); } -#endif } JLOG(j.debug()) << (certainRetry ? "Pass: " : "Final pass: ") << pass diff --git a/src/ripple/app/tx/impl/apply.cpp b/src/ripple/app/tx/impl/apply.cpp index 3e369f06a..a39249a4d 100644 --- a/src/ripple/app/tx/impl/apply.cpp +++ b/src/ripple/app/tx/impl/apply.cpp @@ -168,10 +168,8 @@ applyTransaction( JLOG(j.debug()) << "TXN " << txn.getTransactionID() << (retryAssured ? "/retry" : "/final"); -#ifndef DEBUG try { -#endif auto const result = apply(app, view, txn, flags, j); if (result.second) { @@ -191,14 +189,12 @@ applyTransaction( JLOG(j.debug()) << "Transaction retry: " << transHuman(result.first); return ApplyResult::Retry; -#ifndef DEBUG } catch (std::exception const& ex) { JLOG(j.warn()) << "Throws: " << ex.what(); return ApplyResult::Fail; } -#endif } } // namespace ripple diff --git a/src/ripple/app/tx/impl/applySteps.cpp b/src/ripple/app/tx/impl/applySteps.cpp index 4f29f4501..2ae333fdd 100644 --- a/src/ripple/app/tx/impl/applySteps.cpp +++ b/src/ripple/app/tx/impl/applySteps.cpp @@ -591,19 +591,15 @@ preflight( { PreflightContext const pfctx(app, tx, rules, flags, j); -#ifndef DEBUG try { -#endif return {pfctx, invoke_preflight(pfctx)}; -#ifndef DEBUG } catch (std::exception const& e) { JLOG(j.fatal()) << "apply: " << e.what(); return {pfctx, {tefEXCEPTION, TxConsequences{tx}}}; } -#endif } PreclaimResult @@ -640,21 +636,17 @@ preclaim( preflightResult.j); } -#ifndef DEBUG try { -#endif if (!isTesSuccess(ctx->preflightResult)) return {*ctx, ctx->preflightResult}; return {*ctx, invoke_preclaim(*ctx)}; -#ifndef DEBUG } catch (std::exception const& e) { JLOG(ctx->j.fatal()) << "apply: " << e.what(); return {*ctx, tefEXCEPTION}; } -#endif } XRPAmount @@ -678,10 +670,8 @@ doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view) // info to recover. return {tefEXCEPTION, false}; } -#ifndef DEBUG try { -#endif if (!preclaimResult.likelyToClaimFee) return {preclaimResult.ter, false}; @@ -694,14 +684,12 @@ doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view) preclaimResult.flags, preclaimResult.j); return invoke_apply(ctx); -#ifndef DEBUG } catch (std::exception const& e) { JLOG(preclaimResult.j.fatal()) << "apply: " << e.what(); return {tefEXCEPTION, false}; } -#endif } } // namespace ripple