global: snap

This commit is contained in:
nym21
2026-05-15 23:53:55 +02:00
parent 68db22b9e8
commit 421e5286ce
4 changed files with 21 additions and 9 deletions

View File

@@ -208,7 +208,7 @@ impl Query {
pub fn addr_mempool_hash(&self, addr: &Addr) -> Option<u64> {
let mempool = self.mempool()?;
let bytes = AddrBytes::from_str(addr).ok()?;
Some(mempool.addr_state_hash(&bytes))
mempool.addr_state_hash(&bytes)
}
pub fn addr_mempool_txs(&self, addr: &Addr, limit: usize) -> Result<Vec<Transaction>> {

View File

@@ -1,6 +1,6 @@
use crate::Query;
use brk_error::{Error, Result};
use brk_mempool::{Mempool, PrevoutResolver, RbfForTx, RbfNode};
use brk_mempool::{Mempool, RbfForTx, RbfNode};
use brk_types::{
BlockTemplate, BlockTemplateDiff, CheckedSub, FeeRate, MempoolBlock, MempoolInfo,
MempoolRecentTx, NextBlockHash, OutputType, RbfResponse, RbfTx, RecommendedFees,
@@ -32,8 +32,12 @@ impl Query {
Ok(mempool.block_stats().iter().map(MempoolBlock::from).collect())
}
/// Indexer-backed resolver for confirmed-parent prevouts.
pub fn indexer_prevout_resolver(&self) -> PrevoutResolver {
/// Indexer-backed resolver for confirmed-parent prevouts. Boxed so
/// the caller (typically [`Mempool::start_with`]) can stash one
/// resolver behind a stable type for the lifetime of the loop.
pub fn indexer_prevout_resolver(
&self,
) -> Box<dyn Fn(&[(Txid, Vout)]) -> FxHashMap<(Txid, Vout), TxOut> + Send + Sync> {
let indexer = self.0.indexer;
Box::new(move |holes: &[(Txid, Vout)]| {

View File

@@ -98,6 +98,14 @@ impl Transaction {
FeeRate::from((self.fee, self.vsize()))
}
/// Recompute `total_sigop_cost` from current inputs/outputs and
/// write it back into the field. Cheaper than rebuilding the
/// transaction when prevouts arrive; the only mutator paired with
/// [`Self::total_sigop_cost`].
pub fn refresh_sigops(&mut self) {
self.total_sigop_cost = self.total_sigop_cost();
}
/// Total sigop cost (BIP-141 weight units).
///
/// Mirrors `bitcoin::Transaction::total_sigop_cost`, but reads