feat(chain)!: use custom return types for ElectrumExt methods
This is more code, but a much more elegant solution than having `ElectrumExt` methods return `SyncResult`/`FullScanResult` and having an `ElectrumResultExt` extention trait.
This commit is contained in:
@@ -191,7 +191,8 @@ fn main() -> anyhow::Result<()> {
|
||||
|
||||
let res = client
|
||||
.full_scan::<_>(request, stop_gap, scan_options.batch_size)
|
||||
.context("scanning the blockchain")?;
|
||||
.context("scanning the blockchain")?
|
||||
.with_confirmation_height_anchor();
|
||||
(
|
||||
res.chain_update,
|
||||
res.graph_update,
|
||||
@@ -311,7 +312,8 @@ fn main() -> anyhow::Result<()> {
|
||||
|
||||
let res = client
|
||||
.sync(request, scan_options.batch_size)
|
||||
.context("scanning the blockchain")?;
|
||||
.context("scanning the blockchain")?
|
||||
.with_confirmation_height_anchor();
|
||||
|
||||
// drop lock on graph and chain
|
||||
drop((graph, chain));
|
||||
|
||||
@@ -10,7 +10,6 @@ use bdk::bitcoin::{Address, Amount};
|
||||
use bdk::chain::collections::HashSet;
|
||||
use bdk::{bitcoin::Network, Wallet};
|
||||
use bdk::{KeychainKind, SignOptions};
|
||||
use bdk_electrum::ElectrumResultExt;
|
||||
use bdk_electrum::{
|
||||
electrum_client::{self, ElectrumApi},
|
||||
ElectrumExt,
|
||||
@@ -55,7 +54,7 @@ fn main() -> Result<(), anyhow::Error> {
|
||||
|
||||
let mut update = client
|
||||
.full_scan(request, STOP_GAP, BATCH_SIZE)?
|
||||
.try_into_confirmation_time_result(&client)?;
|
||||
.with_confirmation_time_height_anchor(&client)?;
|
||||
|
||||
let now = std::time::UNIX_EPOCH.elapsed().unwrap().as_secs();
|
||||
let _ = update.graph_update.update_last_seen_unconfirmed(now);
|
||||
|
||||
Reference in New Issue
Block a user