From a39d50f41aa92be3c7112ef962454ad7d6e2ef7b Mon Sep 17 00:00:00 2001 From: Alekos Filini Date: Sun, 3 May 2020 16:15:11 +0200 Subject: [PATCH] Add a generalized "Blockchain" interface --- Cargo.toml | 2 +- examples/repl.rs | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0edd8c3..a3aa967 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ electrum-client = { version = "0.1.0-beta.5", optional = true } [features] minimal = [] compiler = ["miniscript/compiler"] -default = ["sled", "electrum-client"] +default = ["key-value-db", "electrum"] electrum = ["electrum-client"] key-value-db = ["sled"] diff --git a/examples/repl.rs b/examples/repl.rs index 82c41f3..6659851 100644 --- a/examples/repl.rs +++ b/examples/repl.rs @@ -23,6 +23,7 @@ use bitcoin::util::psbt::PartiallySignedTransaction; use bitcoin::{Address, Network, OutPoint}; use magical_bitcoin_wallet::bitcoin; +use magical_bitcoin_wallet::blockchain::ElectrumBlockchain; use magical_bitcoin_wallet::sled; use magical_bitcoin_wallet::types::ScriptType; use magical_bitcoin_wallet::{Client, Wallet}; @@ -255,7 +256,14 @@ fn main() { debug!("database opened successfully"); let client = Client::new(matches.value_of("server").unwrap()).unwrap(); - let wallet = Wallet::new(descriptor, change_descriptor, network, tree, client).unwrap(); + let wallet = Wallet::new( + descriptor, + change_descriptor, + network, + tree, + ElectrumBlockchain::from(client), + ) + .unwrap(); // TODO: print errors in a nice way let handle_matches = |matches: ArgMatches<'_>| { -- 2.49.0