global: snapshot

This commit is contained in:
nym21
2025-12-08 22:20:18 +01:00
parent 60a38b4108
commit 68c71e62d6
4 changed files with 22 additions and 4 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ pub fn init(path: Option<&Path>) -> io::Result<()> {
} }
Builder::from_env(Env::default().default_filter_or( 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", // "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| { .format(move |buf, record| {
+6 -1
View File
@@ -76,7 +76,12 @@ impl MempoolInner {
.collect::<Vec<_>>() .collect::<Vec<_>>()
} }
.into_iter() .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<_, _>>(); .collect::<FxHashMap<_, _>>();
let mut txs = self.txs.write(); let mut txs = self.txs.write();
+1 -1
View File
@@ -64,7 +64,7 @@ pub fn get_transaction(TxidPath { txid }: TxidPath, query: &Query) -> Result<Tra
xori.bytes(&mut buffer, reader.xor_bytes()); xori.bytes(&mut buffer, reader.xor_bytes());
let mut reader = Cursor::new(buffer); 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")); return Err(Error::Str("Failed decode the transaction"));
}; };
+14 -1
View File
@@ -107,7 +107,20 @@ impl Client {
.map_err(Into::into) .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 where
&'a T: Into<&'a bitcoin::Txid>, &'a T: Into<&'a bitcoin::Txid>,
{ {