diff --git a/crates/chain/src/indexer/keychain_txout.rs b/crates/chain/src/indexer/keychain_txout.rs index ccd39dcd9..dc5861a34 100644 --- a/crates/chain/src/indexer/keychain_txout.rs +++ b/crates/chain/src/indexer/keychain_txout.rs @@ -882,12 +882,15 @@ pub trait SyncRequestBuilderExt { /// Add [`Script`](bitcoin::Script)s that are revealed by the `indexer` but currently unused. fn unused_spks_from_indexer(self, indexer: &KeychainTxOutIndex) -> Self; - /// Add unconfirmed txids and their associated spks. - /// - /// We expect that the chain source should include these txids in their spk histories. If not, - /// the transaction has been evicted for some reason and we will inform the receiving - /// structures in the response. - fn check_unconfirmed_statuses( + /// Add txids of unconfirmed transactions and their associated spks to the request to check + /// whether they are missing from the mempool. + /// + /// We expect that the chain source should include these txids in their spk history response. If + /// not, it means the transaction has been evicted from the mempool. The chain + /// source crate should include the missing transaction's txid in + /// [`TxUpdate::missing`](bdk_core::TxUpdate::missing) of + /// [`SyncResponse`](bdk_core::spk_client::SyncResponse). + fn check_for_missing_txs( self, indexer: &KeychainTxOutIndex, canonical_iter: CanonicalIter, @@ -909,7 +912,7 @@ impl SyncRequestBuilderExt for SyncRequest self.spks_with_indexes(indexer.unused_spks()) } - fn check_unconfirmed_statuses( + fn check_for_missing_txs( self, indexer: &KeychainTxOutIndex, canonical_iter: CanonicalIter, diff --git a/crates/electrum/tests/test_electrum.rs b/crates/electrum/tests/test_electrum.rs index cec3531d1..e34a0eea6 100644 --- a/crates/electrum/tests/test_electrum.rs +++ b/crates/electrum/tests/test_electrum.rs @@ -135,7 +135,7 @@ pub fn detect_receive_tx_cancel() -> anyhow::Result<()> { let sync_request = SyncRequest::builder() .chain_tip(chain.tip()) .revealed_spks_from_indexer(&graph.index, ..) - .check_unconfirmed_statuses( + .check_for_missing_txs( &graph.index, graph.graph().canonical_iter(&chain, chain.tip().block_id()), ); @@ -163,7 +163,7 @@ pub fn detect_receive_tx_cancel() -> anyhow::Result<()> { let sync_request = SyncRequest::builder() .chain_tip(chain.tip()) .revealed_spks_from_indexer(&graph.index, ..) - .check_unconfirmed_statuses( + .check_for_missing_txs( &graph.index, graph.graph().canonical_iter(&chain, chain.tip().block_id()), ); diff --git a/crates/esplora/tests/async_ext.rs b/crates/esplora/tests/async_ext.rs index 59cae85c0..5e9613385 100644 --- a/crates/esplora/tests/async_ext.rs +++ b/crates/esplora/tests/async_ext.rs @@ -94,7 +94,7 @@ pub async fn detect_receive_tx_cancel() -> anyhow::Result<()> { let sync_request = SyncRequest::builder() .chain_tip(chain.tip()) .revealed_spks_from_indexer(&graph.index, ..) - .check_unconfirmed_statuses( + .check_for_missing_txs( &graph.index, graph.graph().canonical_iter(&chain, chain.tip().block_id()), ); @@ -122,7 +122,7 @@ pub async fn detect_receive_tx_cancel() -> anyhow::Result<()> { let sync_request = SyncRequest::builder() .chain_tip(chain.tip()) .revealed_spks_from_indexer(&graph.index, ..) - .check_unconfirmed_statuses( + .check_for_missing_txs( &graph.index, graph.graph().canonical_iter(&chain, chain.tip().block_id()), ); diff --git a/crates/esplora/tests/blocking_ext.rs b/crates/esplora/tests/blocking_ext.rs index d558cb917..7c17167f9 100644 --- a/crates/esplora/tests/blocking_ext.rs +++ b/crates/esplora/tests/blocking_ext.rs @@ -94,7 +94,7 @@ pub fn detect_receive_tx_cancel() -> anyhow::Result<()> { let sync_request = SyncRequest::builder() .chain_tip(chain.tip()) .revealed_spks_from_indexer(&graph.index, ..) - .check_unconfirmed_statuses( + .check_for_missing_txs( &graph.index, graph.graph().canonical_iter(&chain, chain.tip().block_id()), ); @@ -122,7 +122,7 @@ pub fn detect_receive_tx_cancel() -> anyhow::Result<()> { let sync_request = SyncRequest::builder() .chain_tip(chain.tip()) .revealed_spks_from_indexer(&graph.index, ..) - .check_unconfirmed_statuses( + .check_for_missing_txs( &graph.index, graph.graph().canonical_iter(&chain, chain.tip().block_id()), );