mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-19 06:14:47 -07:00
global: snap
This commit is contained in:
@@ -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>> {
|
||||
|
||||
@@ -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)]| {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user