From 2bd507a2653d3840dd6c6b8f33db6033c116eb01 Mon Sep 17 00:00:00 2001 From: Giacomo Milligan Date: Tue, 23 Sep 2025 12:39:32 +0200 Subject: [PATCH] [perf]: backport changes from thunder perf hackathon (#68) * [perf]: backport changes from thunder perf hackathon * [misc] Fix std dep order, add comments * [cli] remove mimalloc from cli * [fix] smallvec usage * [misc] Add comments for LMDB flags * [fix] Switch to Borsh and add small test for OutpointKey * [fix] make in/out tracking explicit as per suggestion * [fix] Adjust import ordering * [fix] clarify counts() use, rm into_parts() and explicit deconstruct * [fix] explicit From --- lib/state/block.rs | 7 +++---- lib/state/mod.rs | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/state/block.rs b/lib/state/block.rs index fc40427..260212a 100644 --- a/lib/state/block.rs +++ b/lib/state/block.rs @@ -563,14 +563,13 @@ pub fn disconnect_tip( .try_for_each(|(outpoint, utxo_hash)| { let key = OutPointKey::from(outpoint); if let Some(spent_output) = - state.stxos.try_get(rwtxn, &key).map_err(DbError::from)? + state.stxos.try_get(rwtxn, &key)? { accumulator_diff.insert(utxo_hash.into()); - state.stxos.delete(rwtxn, &key).map_err(DbError::from)?; + state.stxos.delete(rwtxn, &key)?; state .utxos - .put(rwtxn, &key, &spent_output.output) - .map_err(DbError::from)?; + .put(rwtxn, &key, &spent_output.output)?; Ok(()) } else { Err(Error::NoStxo { diff --git a/lib/state/mod.rs b/lib/state/mod.rs index 571c494..25ed6ab 100644 --- a/lib/state/mod.rs +++ b/lib/state/mod.rs @@ -43,7 +43,8 @@ pub struct PrevalidatedBlock { pub computed_merkle_root: MerkleRoot, pub total_fees: bitcoin::Amount, pub coinbase_value: bitcoin::Amount, - pub next_height: u32, // Precomputed next height to avoid DB read in write txn + /// Precomputed next height to avoid DB read in write txn + pub next_height: u32, pub accumulator_diff: crate::types::AccumulatorDiff, }