feat(electrum)!: Update bdk_electrum to use merkle proofs

This commit is contained in:
Wei Chen
2024-06-25 19:20:44 +08:00
parent 1a39821b88
commit d7f4ab71e2
4 changed files with 204 additions and 305 deletions

View File

@@ -193,8 +193,7 @@ fn main() -> anyhow::Result<()> {
let res = client
.full_scan::<_>(request, stop_gap, scan_options.batch_size, false)
.context("scanning the blockchain")?
.with_confirmation_height_anchor();
.context("scanning the blockchain")?;
(
res.chain_update,
res.graph_update,
@@ -317,8 +316,7 @@ fn main() -> anyhow::Result<()> {
let res = client
.sync(request, scan_options.batch_size, false)
.context("scanning the blockchain")?
.with_confirmation_height_anchor();
.context("scanning the blockchain")?;
// drop lock on graph and chain
drop((graph, chain));
@@ -345,7 +343,12 @@ fn main() -> anyhow::Result<()> {
let keychain_changeset = graph.index.reveal_to_target_multi(&keychain_update);
indexed_tx_graph_changeset.merge(keychain_changeset.into());
}
indexed_tx_graph_changeset.merge(graph.apply_update(graph_update));
indexed_tx_graph_changeset.merge(graph.apply_update(graph_update.map_anchors(|a| {
ConfirmationHeightAnchor {
confirmation_height: a.confirmation_height,
anchor_block: a.anchor_block,
}
})));
(chain_changeset, indexed_tx_graph_changeset)
};

View File

@@ -63,9 +63,7 @@ fn main() -> Result<(), anyhow::Error> {
})
.inspect_spks_for_all_keychains(|_, _, _| std::io::stdout().flush().expect("must flush"));
let mut update = client
.full_scan(request, STOP_GAP, BATCH_SIZE, false)?
.with_confirmation_time_height_anchor(&client)?;
let mut update = client.full_scan(request, STOP_GAP, BATCH_SIZE, false)?;
let now = std::time::UNIX_EPOCH.elapsed().unwrap().as_secs();
let _ = update.graph_update.update_last_seen_unconfirmed(now);