[blockchain] Add a trait to create Blockchains from a configuration

This is the first set of changes for #42
This commit is contained in:
Alekos Filini
2020-09-10 18:08:37 +02:00
parent 6094656a54
commit 5eee18bed2
5 changed files with 98 additions and 10 deletions

View File

@@ -152,6 +152,15 @@ pub trait Blockchain: BlockchainMarker {
fn estimate_fee(&self, target: usize) -> Result<FeeRate, Error>;
}
/// Trait for [`Blockchain`] types that can be created given a configuration
pub trait ConfigurableBlockchain: Blockchain + Sized {
/// Type that contains the configuration
type Config: std::fmt::Debug;
/// Create a new instance given a configuration
fn from_config(config: &Self::Config) -> Result<Self, Error>;
}
/// Data sent with a progress update over a [`channel`]
pub type ProgressData = (f32, Option<String>);