diff --git a/src/lib.rs b/src/lib.rs index 75ac2d6..e135f5c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,6 +34,13 @@ pub use electrum_client; pub use error::Error; pub use which; +#[derive(Debug, Clone)] +pub enum Backend { + Electrs, + Esplora, + Mempool, +} + /// Electrs configuration parameters, implements a convenient [Default] for most common use. /// /// Default values: @@ -81,6 +88,9 @@ pub struct Conf<'a> { /// Persistent directory path pub staticdir: Option, + /// The backend type in use + pub backend: Backend, + /// Try to spawn the process `attempt` time /// /// The OS is giving available ports to use, however, they aren't booked, so it could rarely @@ -110,6 +120,7 @@ impl Default for Conf<'_> { staticdir: None, attempts: 3, buffered_logs: false, + backend: Backend::Electrs, } } } @@ -202,7 +213,11 @@ impl ElectrsD { let cookie_file; #[cfg(not(feature = "legacy"))] { - args.push("--cookie-file"); + if let Backend::Mempool = conf.backend { + args.push("--cookie"); + } else { + args.push("--cookie-file"); + } cookie_file = format!("{}", bitcoind.params.cookie_file.display()); args.push(&cookie_file); }