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

10
Cargo.lock generated
View File

@@ -1823,7 +1823,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46"
dependencies = [
"hermit-abi",
"libc",
"windows-sys 0.52.0",
"windows-sys 0.61.2",
]
[[package]]
@@ -2798,9 +2798,9 @@ dependencies = [
[[package]]
name = "serde_qs"
version = "1.1.1"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2316d01592c3382277c5062105510e35e0a6bfb2851e30028485f7af8cf1240"
checksum = "67d525c8ff68aa99e5818302259bdd02d86d0303710616f39c0f44846ff6d332"
dependencies = [
"axum",
"itoa",
@@ -3702,9 +3702,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "winnow"
version = "1.0.2"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ee1708bef14716a11bae175f579062d4554d95be2c6829f518df847b7b3fdd0"
checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1"
[[package]]
name = "wio"

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