Merge bitcoindevkit/bdk#1306: Implement ElectrumExt for all that implements ElectrumApi

ce8c617c9d562a54728c6cafc0562a66bae56b3e feat(electrum): impl `ElectrumExt` for all that impl `ElectrumApi` (志宇)

Pull request description:

  ### Description

  Implement `ElectrumExt` for all that implements `ElectrumApi`.

  I realized this while looking into #1171.

  2196685cca/crates/electrum/tests/test_electrum.rs (L54-L55)

  Line 55 here should not be necessary.

  ### Changelog notice

  * Changed to implement `ElectrumExt` for all that implements `ElectrumApi`.

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

ACKs for top commit:
  notmandatory:
    ACK ce8c617c9d562a54728c6cafc0562a66bae56b3e

Tree-SHA512: d95193a9a356a0aa3f467db3b8c7bf2cfdf83afd520f5254721912cfe82355de1198256b90323e51ffdb0bf955ff923a9ceb8b4541d4a5ad2331ff0bf26ab937
This commit is contained in:
Steve Myers 2024-01-31 08:59:05 -06:00
commit f099b42005
No known key found for this signature in database
GPG Key ID: 8105A46B22C2D051

View File

@ -179,7 +179,7 @@ pub trait ElectrumExt {
) -> Result<ElectrumUpdate, Error>;
}
impl ElectrumExt for Client {
impl<A: ElectrumApi> ElectrumExt for A {
fn full_scan<K: Ord + Clone>(
&self,
prev_tip: CheckPoint,
@ -303,7 +303,7 @@ impl ElectrumExt for Client {
/// Return a [`CheckPoint`] of the latest tip, that connects with `prev_tip`.
fn construct_update_tip(
client: &Client,
client: &impl ElectrumApi,
prev_tip: CheckPoint,
) -> Result<(CheckPoint, Option<u32>), Error> {
let HeaderNotification { height, .. } = client.block_headers_subscribe()?;
@ -417,7 +417,7 @@ fn determine_tx_anchor(
}
fn populate_with_outpoints(
client: &Client,
client: &impl ElectrumApi,
cps: &BTreeMap<u32, CheckPoint>,
relevant_txids: &mut RelevantTxids,
outpoints: impl IntoIterator<Item = OutPoint>,
@ -478,7 +478,7 @@ fn populate_with_outpoints(
}
fn populate_with_txids(
client: &Client,
client: &impl ElectrumApi,
cps: &BTreeMap<u32, CheckPoint>,
relevant_txids: &mut RelevantTxids,
txids: impl IntoIterator<Item = Txid>,
@ -514,7 +514,7 @@ fn populate_with_txids(
}
fn populate_with_spks<I: Ord + Clone>(
client: &Client,
client: &impl ElectrumApi,
cps: &BTreeMap<u32, CheckPoint>,
relevant_txids: &mut RelevantTxids,
spks: &mut impl Iterator<Item = (I, ScriptBuf)>,