mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-19 14:24:47 -07:00
global: fixes
This commit is contained in:
@@ -85,9 +85,9 @@ impl Query {
|
||||
tx_count: addr_data.tx_count,
|
||||
realized_price,
|
||||
},
|
||||
mempool_stats: self.mempool().and_then(|m| {
|
||||
m.addrs().get(&bytes).map(|(stats, _)| stats.clone())
|
||||
}),
|
||||
mempool_stats: self
|
||||
.mempool()
|
||||
.and_then(|m| m.addrs().get(&bytes).map(|(stats, _)| stats.clone())),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -57,12 +57,7 @@ impl Query {
|
||||
}
|
||||
|
||||
let height = Height::from(best_height);
|
||||
let blockhash = indexer
|
||||
.vecs
|
||||
.blocks
|
||||
.blockhash
|
||||
.collect_one(height)
|
||||
.data()?;
|
||||
let blockhash = indexer.vecs.blocks.blockhash.collect_one(height).data()?;
|
||||
|
||||
// Convert timestamp to ISO 8601 format
|
||||
let ts_secs: i64 = (*best_ts).into();
|
||||
|
||||
@@ -3,9 +3,9 @@ use std::cmp::Ordering;
|
||||
use brk_error::{Error, Result};
|
||||
use brk_mempool::{Entry, EntryPool, Removal, Tombstone, TxGraveyard, TxStore};
|
||||
use brk_types::{
|
||||
CheckedSub, CpfpEntry, CpfpInfo, FeeRate, MempoolBlock, MempoolInfo, MempoolRecentTx, OutputType,
|
||||
RbfResponse, RbfTx, RecommendedFees, ReplacementNode, Sats, Timestamp, Transaction, TxOut,
|
||||
TxOutIndex, Txid, TxidPrefix, TypeIndex, VSize, Weight,
|
||||
CheckedSub, CpfpEntry, CpfpInfo, FeeRate, MempoolBlock, MempoolInfo, MempoolRecentTx,
|
||||
OutputType, RbfResponse, RbfTx, RecommendedFees, ReplacementNode, Sats, Timestamp, Transaction,
|
||||
TxOut, TxOutIndex, Txid, TxidPrefix, TypeIndex, VSize, Weight,
|
||||
};
|
||||
use rustc_hash::FxHashSet;
|
||||
use vecdb::VecIndex;
|
||||
@@ -178,7 +178,8 @@ impl Query {
|
||||
let graveyard = mempool.graveyard();
|
||||
|
||||
let mut root_txid = txid.clone();
|
||||
while let Some(Removal::Replaced { by }) = graveyard.get(&root_txid).map(Tombstone::reason) {
|
||||
while let Some(Removal::Replaced { by }) = graveyard.get(&root_txid).map(Tombstone::reason)
|
||||
{
|
||||
root_txid = by.clone();
|
||||
}
|
||||
|
||||
@@ -188,8 +189,8 @@ impl Query {
|
||||
.collect();
|
||||
let replaces = (!replaces_vec.is_empty()).then_some(replaces_vec);
|
||||
|
||||
let replacements = Self::build_rbf_node(&root_txid, None, &txs, &entries, &graveyard)
|
||||
.map(|mut node| {
|
||||
let replacements =
|
||||
Self::build_rbf_node(&root_txid, None, &txs, &entries, &graveyard).map(|mut node| {
|
||||
node.tx.full_rbf = Some(node.full_rbf);
|
||||
node.interval = None;
|
||||
node
|
||||
@@ -210,14 +211,10 @@ impl Query {
|
||||
entries: &'a EntryPool,
|
||||
graveyard: &'a TxGraveyard,
|
||||
) -> Option<(&'a Transaction, &'a Entry)> {
|
||||
if let (Some(tx), Some(entry)) =
|
||||
(txs.get(txid), entries.get(&TxidPrefix::from(txid)))
|
||||
{
|
||||
if let (Some(tx), Some(entry)) = (txs.get(txid), entries.get(&TxidPrefix::from(txid))) {
|
||||
return Some((tx, entry));
|
||||
}
|
||||
graveyard
|
||||
.get(txid)
|
||||
.map(|tomb| (&tomb.tx, &tomb.entry))
|
||||
graveyard.get(txid).map(|tomb| (&tomb.tx, &tomb.entry))
|
||||
}
|
||||
|
||||
/// Recursively build an RBF tree node rooted at `txid`.
|
||||
|
||||
@@ -78,7 +78,9 @@ impl BlockWindow {
|
||||
.collect_range_at(self.start, self.end);
|
||||
let all_prices: Vec<Cents> = computer
|
||||
.prices
|
||||
.spot.cents.height
|
||||
.spot
|
||||
.cents
|
||||
.height
|
||||
.collect_range_at(self.start, self.end);
|
||||
let read_start = self.start.saturating_sub(1);
|
||||
let all_cum = cumulative.collect_range_at(read_start, self.end);
|
||||
|
||||
@@ -3,10 +3,10 @@ use std::{collections::BTreeMap, sync::LazyLock};
|
||||
use brk_error::{Error, Result};
|
||||
use brk_traversable::TreeNode;
|
||||
use brk_types::{
|
||||
BlockHashPrefix, Date, DetailedSeriesCount, Epoch, Format, Halving, Height, Index,
|
||||
IndexInfo, LegacyValue, Limit, Output, OutputLegacy, PaginatedSeries, Pagination,
|
||||
PaginationIndex, RangeIndex, RangeMap, SearchQuery, SeriesData, SeriesInfo, SeriesName,
|
||||
SeriesOutput, SeriesOutputLegacy, SeriesSelection, Timestamp, Version,
|
||||
BlockHashPrefix, Date, DetailedSeriesCount, Epoch, Format, Halving, Height, Index, IndexInfo,
|
||||
LegacyValue, Limit, Output, OutputLegacy, PaginatedSeries, Pagination, PaginationIndex,
|
||||
RangeIndex, RangeMap, SearchQuery, SeriesData, SeriesInfo, SeriesName, SeriesOutput,
|
||||
SeriesOutputLegacy, SeriesSelection, Timestamp, Version,
|
||||
};
|
||||
use parking_lot::RwLock;
|
||||
use vecdb::{AnyExportableVec, ReadableVec};
|
||||
|
||||
@@ -190,16 +190,15 @@ impl Query {
|
||||
let spending_txid = txid_reader.get(spending_tx_index.to_usize());
|
||||
let spending_height: Height = tx_heights.get_shared(spending_tx_index).data()?;
|
||||
|
||||
let (block_hash, block_time) =
|
||||
if let Some((h, ref bh, bt)) = cached_status
|
||||
&& h == spending_height
|
||||
{
|
||||
(bh.clone(), bt)
|
||||
} else {
|
||||
let (bh, bt) = self.block_hash_and_time(spending_height)?;
|
||||
cached_status = Some((spending_height, bh.clone(), bt));
|
||||
(bh, bt)
|
||||
};
|
||||
let (block_hash, block_time) = if let Some((h, ref bh, bt)) = cached_status
|
||||
&& h == spending_height
|
||||
{
|
||||
(bh.clone(), bt)
|
||||
} else {
|
||||
let (bh, bt) = self.block_hash_and_time(spending_height)?;
|
||||
cached_status = Some((spending_height, bh.clone(), bt));
|
||||
(bh, bt)
|
||||
};
|
||||
|
||||
outspends.push(TxOutspend {
|
||||
spent: true,
|
||||
|
||||
Reference in New Issue
Block a user