MCPcopy Create free account
hub / github.com/bwt-dev/bwt / sync_mempool

Method sync_mempool

src/indexer.rs:366–379  ·  view source on GitHub ↗

Update missing/outdated mempool entries for unconfirmed mempool transactions (or all mempool entries when force_refresh is set, during the initial sync or following a chain tip update)

(&mut self, force_refresh: bool)

Source from the content-addressed store, hash-verified

364 /// Update missing/outdated mempool entries for unconfirmed mempool transactions (or all mempool
365 /// entries when force_refresh is set, during the initial sync or following a chain tip update)
366 fn sync_mempool(&mut self, force_refresh: bool) {
367 let mempool = self.store.mempool_mut();
368
369 for (txid, opt_entry) in mempool.iter_mut() {
370 if force_refresh || opt_entry.is_none() {
371 match self.rpc.get_mempool_entry(txid) {
372 Ok(rpc_entry) => *opt_entry = Some(rpc_entry.into()),
373 Err(e) => warn!("failed fetching mempool entry for {}: {}", txid, e),
374 }
375 }
376 }
377
378 // TODO use batch rpc
379 }
380
381 /// Get historical events that happened at or after `min_block_height`, including unconfirmed,
382 /// ordered with oldest first.

Callers 2

initial_syncMethod · 0.80
syncMethod · 0.80

Calls 3

mempool_mutMethod · 0.80
intoMethod · 0.80
get_mempool_entryMethod · 0.45

Tested by

no test coverage detected