mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 06:39:58 -07:00
global: snapshot
This commit is contained in:
@@ -28,7 +28,7 @@ pub fn init(path: Option<&Path>) -> io::Result<()> {
|
||||
}
|
||||
|
||||
Builder::from_env(Env::default().default_filter_or(
|
||||
"debug,bitcoin=off,bitcoincore-rpc=off,fjall=off,brk_fjall=off,lsm_tree=off,rolldown=off,rmcp=off,brk_rmcp=off,tracing=off,aide=off,rustls=off",
|
||||
"info,bitcoin=off,bitcoincore-rpc=off,fjall=off,brk_fjall=off,lsm_tree=off,rolldown=off,rmcp=off,brk_rmcp=off,tracing=off,aide=off,rustls=off",
|
||||
// "debug,fjall=trace,bitcoin=off,bitcoincore-rpc=off,rolldown=off,rmcp=off,brk_rmcp=off,tracing=off,aide=off,rustls=off",
|
||||
))
|
||||
.format(move |buf, record| {
|
||||
|
||||
@@ -76,7 +76,12 @@ impl MempoolInner {
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
.into_iter()
|
||||
.filter_map(|txid| self.client.get_transaction(&txid).ok().map(|tx| (txid, tx)))
|
||||
.filter_map(|txid| {
|
||||
self.client
|
||||
.get_mempool_transaction(&txid)
|
||||
.ok()
|
||||
.map(|tx| (txid, tx))
|
||||
})
|
||||
.collect::<FxHashMap<_, _>>();
|
||||
|
||||
let mut txs = self.txs.write();
|
||||
|
||||
@@ -64,7 +64,7 @@ pub fn get_transaction(TxidPath { txid }: TxidPath, query: &Query) -> Result<Tra
|
||||
xori.bytes(&mut buffer, reader.xor_bytes());
|
||||
|
||||
let mut reader = Cursor::new(buffer);
|
||||
let Ok(_) = bitcoin::Transaction::consensus_decode(&mut reader) else {
|
||||
let Ok(tx) = bitcoin::Transaction::consensus_decode(&mut reader) else {
|
||||
return Err(Error::Str("Failed decode the transaction"));
|
||||
};
|
||||
|
||||
|
||||
@@ -107,7 +107,20 @@ impl Client {
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
pub fn get_transaction<'a, T>(&self, txid: &'a T) -> Result<Transaction>
|
||||
pub fn get_transaction<'a, T, H>(
|
||||
&self,
|
||||
txid: &'a T,
|
||||
block_hash: Option<&'a H>,
|
||||
) -> brk_error::Result<bitcoin::Transaction>
|
||||
where
|
||||
&'a T: Into<&'a bitcoin::Txid>,
|
||||
&'a H: Into<&'a bitcoin::BlockHash>,
|
||||
{
|
||||
let tx = self.get_raw_transaction(txid, block_hash)?;
|
||||
Ok(tx)
|
||||
}
|
||||
|
||||
pub fn get_mempool_transaction<'a, T>(&self, txid: &'a T) -> Result<Transaction>
|
||||
where
|
||||
&'a T: Into<&'a bitcoin::Txid>,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user