mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-20 07:28:11 -07:00
global: snapshot + monitor: add addresses to mempool
This commit is contained in:
@@ -3,8 +3,8 @@ use std::str::FromStr;
|
||||
use bitcoin::{Network, PublicKey, ScriptBuf};
|
||||
use brk_error::{Error, Result};
|
||||
use brk_structs::{
|
||||
Address, AddressBytes, AddressBytesHash, AddressStats, AnyAddressDataIndexEnum, Bitcoin,
|
||||
OutputType,
|
||||
Address, AddressBytes, AddressBytesHash, AddressChainStats, AddressMempoolStats, AddressStats,
|
||||
AnyAddressDataIndexEnum, Bitcoin, OutputType,
|
||||
};
|
||||
use vecdb::{AnyIterableVec, VecIterator};
|
||||
|
||||
@@ -104,9 +104,11 @@ pub fn get_address(Address { address }: Address, interface: &Interface) -> Resul
|
||||
.into(),
|
||||
};
|
||||
|
||||
let balance = address_data.balance();
|
||||
|
||||
todo!();
|
||||
Ok(AddressStats {
|
||||
address: address.into(),
|
||||
chain_stats: AddressChainStats::default(),
|
||||
mempool_stats: AddressMempoolStats::default(),
|
||||
})
|
||||
|
||||
// Ok(Address {
|
||||
// address: address.to_string(),
|
||||
|
||||
@@ -4,15 +4,18 @@ use std::{
|
||||
str::FromStr,
|
||||
};
|
||||
|
||||
use bitcoin::{Transaction, consensus::Decodable};
|
||||
use bitcoin::consensus::Decodable;
|
||||
use brk_error::{Error, Result};
|
||||
use brk_parser::XORIndex;
|
||||
use brk_structs::{Tx, Txid, TxidPath, TxidPrefix};
|
||||
use brk_reader::XORIndex;
|
||||
use brk_structs::{Transaction, Txid, TxidPath, TxidPrefix};
|
||||
use vecdb::VecIterator;
|
||||
|
||||
use crate::Interface;
|
||||
|
||||
pub fn get_transaction_info(TxidPath { txid }: TxidPath, interface: &Interface) -> Result<Tx> {
|
||||
pub fn get_transaction_info(
|
||||
TxidPath { txid }: TxidPath,
|
||||
interface: &Interface,
|
||||
) -> Result<Transaction> {
|
||||
let Ok(txid) = bitcoin::Txid::from_str(&txid) else {
|
||||
return Err(Error::InvalidTxid);
|
||||
};
|
||||
@@ -72,7 +75,7 @@ pub fn get_transaction_info(TxidPath { txid }: TxidPath, interface: &Interface)
|
||||
xori.bytes(&mut buffer, parser.xor_bytes());
|
||||
|
||||
let mut reader = Cursor::new(buffer);
|
||||
let Ok(_) = Transaction::consensus_decode(&mut reader) else {
|
||||
let Ok(_) = bitcoin::Transaction::consensus_decode(&mut reader) else {
|
||||
return Err(Error::Str("Failed decode the transaction"));
|
||||
};
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ use std::collections::BTreeMap;
|
||||
use brk_computer::Computer;
|
||||
use brk_error::Result;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_parser::Parser;
|
||||
use brk_reader::Reader;
|
||||
use brk_structs::{
|
||||
Address, AddressStats, Format, Height, Index, IndexInfo, Limit, Metric, MetricCount, Tx,
|
||||
TxidPath,
|
||||
Address, AddressStats, Format, Height, Index, IndexInfo, Limit, Metric, MetricCount,
|
||||
Transaction, TxidPath,
|
||||
};
|
||||
use brk_traversable::TreeNode;
|
||||
use vecdb::{AnyCollectableVec, AnyStoredVec};
|
||||
@@ -33,13 +33,13 @@ use crate::{
|
||||
#[allow(dead_code)]
|
||||
pub struct Interface<'a> {
|
||||
vecs: Vecs<'a>,
|
||||
parser: &'a Parser,
|
||||
parser: &'a Reader,
|
||||
indexer: &'a Indexer,
|
||||
computer: &'a Computer,
|
||||
}
|
||||
|
||||
impl<'a> Interface<'a> {
|
||||
pub fn build(parser: &Parser, indexer: &Indexer, computer: &Computer) -> Self {
|
||||
pub fn build(parser: &Reader, indexer: &Indexer, computer: &Computer) -> Self {
|
||||
let parser = parser.static_clone();
|
||||
let indexer = indexer.static_clone();
|
||||
let computer = computer.static_clone();
|
||||
@@ -61,7 +61,7 @@ impl<'a> Interface<'a> {
|
||||
get_address(address, self)
|
||||
}
|
||||
|
||||
pub fn get_transaction_info(&self, txid: TxidPath) -> Result<Tx> {
|
||||
pub fn get_transaction_info(&self, txid: TxidPath) -> Result<Transaction> {
|
||||
get_transaction_info(txid, self)
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ impl<'a> Interface<'a> {
|
||||
self.vecs.metric_to_indexes(metric)
|
||||
}
|
||||
|
||||
pub fn parser(&self) -> &Parser {
|
||||
pub fn parser(&self) -> &Reader {
|
||||
self.parser
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user