pub struct Builder { /* private fields */ }
Expand description
A builder for an Node
instance, allowing to set some configuration and module choices from
the getgo.
Defaults
- Wallet entropy is sourced from a
keys_seed
file located underConfig::storage_dir_path
- Chain data is sourced from the Esplora endpoint
https://blockstream.info/api
- Gossip data is sourced via the peer-to-peer network
Implementations§
source§impl NodeBuilder
impl NodeBuilder
sourcepub fn from_config(config: Config) -> Self
pub fn from_config(config: Config) -> Self
Creates a new builder instance from an Config
.
sourcepub fn set_entropy_seed_path(&mut self, seed_path: String) -> &mut Self
pub fn set_entropy_seed_path(&mut self, seed_path: String) -> &mut Self
Configures the Node
instance to source its wallet entropy from a seed file on disk.
If the given file does not exist a new random seed file will be generated and stored at the given location.
sourcepub fn set_entropy_seed_bytes(
&mut self,
seed_bytes: Vec<u8>
) -> Result<&mut Self, BuildError>
pub fn set_entropy_seed_bytes( &mut self, seed_bytes: Vec<u8> ) -> Result<&mut Self, BuildError>
Configures the Node
instance to source its wallet entropy from the given 64 seed bytes.
Note: Panics if the length of the given seed_bytes
differs from 64.
sourcepub fn set_entropy_bip39_mnemonic(
&mut self,
mnemonic: Mnemonic,
passphrase: Option<String>
) -> &mut Self
pub fn set_entropy_bip39_mnemonic( &mut self, mnemonic: Mnemonic, passphrase: Option<String> ) -> &mut Self
sourcepub fn set_esplora_server(&mut self, esplora_server_url: String) -> &mut Self
pub fn set_esplora_server(&mut self, esplora_server_url: String) -> &mut Self
Configures the Node
instance to source its chain data from the given Esplora server.
sourcepub fn set_gossip_source_p2p(&mut self) -> &mut Self
pub fn set_gossip_source_p2p(&mut self) -> &mut Self
Configures the Node
instance to source its gossip data from the Lightning peer-to-peer
network.
sourcepub fn set_gossip_source_rgs(&mut self, rgs_server_url: String) -> &mut Self
pub fn set_gossip_source_rgs(&mut self, rgs_server_url: String) -> &mut Self
Configures the Node
instance to source its gossip data from the given RapidGossipSync
server.
sourcepub fn set_storage_dir_path(&mut self, storage_dir_path: String) -> &mut Self
pub fn set_storage_dir_path(&mut self, storage_dir_path: String) -> &mut Self
Sets the used storage directory path.
sourcepub fn set_network(&mut self, network: Network) -> &mut Self
pub fn set_network(&mut self, network: Network) -> &mut Self
Sets the Bitcoin network used.
sourcepub fn set_listening_address(
&mut self,
listening_address: NetAddress
) -> &mut Self
pub fn set_listening_address( &mut self, listening_address: NetAddress ) -> &mut Self
Sets the IP address and TCP port on which Node
will listen for incoming network connections.
sourcepub fn set_log_level(&mut self, level: LogLevel) -> &mut Self
pub fn set_log_level(&mut self, level: LogLevel) -> &mut Self
Sets the level at which Node
will log messages.
sourcepub fn build(&self) -> Result<Node<SqliteStore>, BuildError>
pub fn build(&self) -> Result<Node<SqliteStore>, BuildError>
Builds a Node
instance with a SqliteStore
backend and according to the options
previously configured.
sourcepub fn build_with_fs_store(&self) -> Result<Node<FilesystemStore>, BuildError>
pub fn build_with_fs_store(&self) -> Result<Node<FilesystemStore>, BuildError>
Builds a Node
instance with a FilesystemStore
backend and according to the options
previously configured.
sourcepub fn build_with_store<K: KVStore + Sync + Send + 'static>(
&self,
kv_store: Arc<K>
) -> Result<Node<K>, BuildError>
pub fn build_with_store<K: KVStore + Sync + Send + 'static>( &self, kv_store: Arc<K> ) -> Result<Node<K>, BuildError>
Builds a Node
instance according to the options previously configured.