@@ -104,65 +104,77 @@ impl NodeBuilder {
104104 ///
105105 /// If the given file does not exist a new random seed file will be generated and
106106 /// stored at the given location.
107- pub fn set_entropy_seed_path ( & mut self , seed_path : String ) {
107+ pub fn set_entropy_seed_path ( & mut self , seed_path : String ) -> & mut Self {
108108 self . entropy_source_config = Some ( EntropySourceConfig :: SeedFile ( seed_path) ) ;
109+ self
109110 }
110111
111112 /// Configures the [`Node`] instance to source its wallet entropy from the given 64 seed bytes.
112113 ///
113114 /// **Note:** Panics if the length of the given `seed_bytes` differs from 64.
114- pub fn set_entropy_seed_bytes ( & mut self , seed_bytes : Vec < u8 > ) {
115+ pub fn set_entropy_seed_bytes ( & mut self , seed_bytes : Vec < u8 > ) -> & mut Self {
115116 if seed_bytes. len ( ) != WALLET_KEYS_SEED_LEN {
116117 panic ! ( "Failed to set seed due to invalid length." ) ;
117118 }
118119 let mut bytes = [ 0u8 ; WALLET_KEYS_SEED_LEN ] ;
119120 bytes. copy_from_slice ( & seed_bytes) ;
120121 self . entropy_source_config = Some ( EntropySourceConfig :: SeedBytes ( bytes) ) ;
122+ self
121123 }
122124
123125 /// Configures the [`Node`] instance to source its wallet entropy from a [BIP 39] mnemonic.
124126 ///
125127 /// [BIP 39]: https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki
126- pub fn set_entropy_bip39_mnemonic ( & mut self , mnemonic : Mnemonic , passphrase : Option < String > ) {
128+ pub fn set_entropy_bip39_mnemonic (
129+ & mut self , mnemonic : Mnemonic , passphrase : Option < String > ,
130+ ) -> & mut Self {
127131 self . entropy_source_config =
128132 Some ( EntropySourceConfig :: Bip39Mnemonic { mnemonic, passphrase } ) ;
133+ self
129134 }
130135
131136 /// Configures the [`Node`] instance to source its chain data from the given Esplora server.
132- pub fn set_esplora_server ( & mut self , esplora_server_url : String ) {
137+ pub fn set_esplora_server ( & mut self , esplora_server_url : String ) -> & mut Self {
133138 self . chain_data_source_config = Some ( ChainDataSourceConfig :: Esplora ( esplora_server_url) ) ;
139+ self
134140 }
135141
136142 /// Configures the [`Node`] instance to source its gossip data from the Lightning peer-to-peer
137143 /// network.
138- pub fn set_gossip_source_p2p ( & mut self ) {
144+ pub fn set_gossip_source_p2p ( & mut self ) -> & mut Self {
139145 self . gossip_source_config = Some ( GossipSourceConfig :: P2PNetwork ) ;
146+ self
140147 }
141148
142149 /// Configures the [`Node`] instance to source its gossip data from the given RapidGossipSync
143150 /// server.
144- pub fn set_gossip_source_rgs ( & mut self , rgs_server_url : String ) {
151+ pub fn set_gossip_source_rgs ( & mut self , rgs_server_url : String ) -> & mut Self {
145152 self . gossip_source_config = Some ( GossipSourceConfig :: RapidGossipSync ( rgs_server_url) ) ;
153+ self
146154 }
147155
148156 /// Sets the used storage directory path.
149- pub fn set_storage_dir_path ( & mut self , storage_dir_path : String ) {
157+ pub fn set_storage_dir_path ( & mut self , storage_dir_path : String ) -> & mut Self {
150158 self . config . storage_dir_path = storage_dir_path;
159+ self
151160 }
152161
153162 /// Sets the Bitcoin network used.
154- pub fn set_network ( & mut self , network : Network ) {
163+ pub fn set_network ( & mut self , network : Network ) -> & mut Self {
155164 self . config . network = network;
165+ self
156166 }
157167
158168 /// Sets the IP address and TCP port on which [`Node`] will listen for incoming network connections.
159- pub fn set_listening_address ( & mut self , listening_address : NetAddress ) {
169+ pub fn set_listening_address ( & mut self , listening_address : NetAddress ) -> & mut Self {
160170 self . config . listening_address = Some ( listening_address) ;
171+ self
161172 }
162173
163174 /// Sets the level at which [`Node`] will log messages.
164- pub fn set_log_level ( & mut self , level : LogLevel ) {
175+ pub fn set_log_level ( & mut self , level : LogLevel ) -> & mut Self {
165176 self . config . log_level = level;
177+ self
166178 }
167179
168180 /// Builds a [`Node`] instance with a [`SqliteStore`] backend and according to the options
@@ -233,58 +245,58 @@ impl ArcedNodeBuilder {
233245 /// If the given file does not exist a new random seed file will be generated and
234246 /// stored at the given location.
235247 pub fn set_entropy_seed_path ( & self , seed_path : String ) {
236- self . inner . write ( ) . unwrap ( ) . set_entropy_seed_path ( seed_path)
248+ self . inner . write ( ) . unwrap ( ) . set_entropy_seed_path ( seed_path) ;
237249 }
238250
239251 /// Configures the [`Node`] instance to source its wallet entropy from the given 64 seed bytes.
240252 ///
241253 /// **Note:** Panics if the length of the given `seed_bytes` differs from 64.
242254 pub fn set_entropy_seed_bytes ( & self , seed_bytes : Vec < u8 > ) {
243- self . inner . write ( ) . unwrap ( ) . set_entropy_seed_bytes ( seed_bytes)
255+ self . inner . write ( ) . unwrap ( ) . set_entropy_seed_bytes ( seed_bytes) ;
244256 }
245257
246258 /// Configures the [`Node`] instance to source its wallet entropy from a [BIP 39] mnemonic.
247259 ///
248260 /// [BIP 39]: https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki
249261 pub fn set_entropy_bip39_mnemonic ( & self , mnemonic : Mnemonic , passphrase : Option < String > ) {
250- self . inner . write ( ) . unwrap ( ) . set_entropy_bip39_mnemonic ( mnemonic, passphrase)
262+ self . inner . write ( ) . unwrap ( ) . set_entropy_bip39_mnemonic ( mnemonic, passphrase) ;
251263 }
252264
253265 /// Configures the [`Node`] instance to source its chain data from the given Esplora server.
254266 pub fn set_esplora_server ( & self , esplora_server_url : String ) {
255- self . inner . write ( ) . unwrap ( ) . set_esplora_server ( esplora_server_url)
267+ self . inner . write ( ) . unwrap ( ) . set_esplora_server ( esplora_server_url) ;
256268 }
257269
258270 /// Configures the [`Node`] instance to source its gossip data from the Lightning peer-to-peer
259271 /// network.
260272 pub fn set_gossip_source_p2p ( & self ) {
261- self . inner . write ( ) . unwrap ( ) . set_gossip_source_p2p ( )
273+ self . inner . write ( ) . unwrap ( ) . set_gossip_source_p2p ( ) ;
262274 }
263275
264276 /// Configures the [`Node`] instance to source its gossip data from the given RapidGossipSync
265277 /// server.
266278 pub fn set_gossip_source_rgs ( & self , rgs_server_url : String ) {
267- self . inner . write ( ) . unwrap ( ) . set_gossip_source_rgs ( rgs_server_url)
279+ self . inner . write ( ) . unwrap ( ) . set_gossip_source_rgs ( rgs_server_url) ;
268280 }
269281
270282 /// Sets the used storage directory path.
271283 pub fn set_storage_dir_path ( & self , storage_dir_path : String ) {
272- self . inner . write ( ) . unwrap ( ) . set_storage_dir_path ( storage_dir_path)
284+ self . inner . write ( ) . unwrap ( ) . set_storage_dir_path ( storage_dir_path) ;
273285 }
274286
275287 /// Sets the Bitcoin network used.
276288 pub fn set_network ( & self , network : Network ) {
277- self . inner . write ( ) . unwrap ( ) . set_network ( network)
289+ self . inner . write ( ) . unwrap ( ) . set_network ( network) ;
278290 }
279291
280292 /// Sets the IP address and TCP port on which [`Node`] will listen for incoming network connections.
281293 pub fn set_listening_address ( & self , listening_address : NetAddress ) {
282- self . inner . write ( ) . unwrap ( ) . set_listening_address ( listening_address)
294+ self . inner . write ( ) . unwrap ( ) . set_listening_address ( listening_address) ;
283295 }
284296
285297 /// Sets the level at which [`Node`] will log messages.
286298 pub fn set_log_level ( & self , level : LogLevel ) {
287- self . inner . write ( ) . unwrap ( ) . set_log_level ( level)
299+ self . inner . write ( ) . unwrap ( ) . set_log_level ( level) ;
288300 }
289301
290302 /// Builds a [`Node`] instance with a [`SqliteStore`] backend and according to the options
0 commit comments