@@ -104,65 +104,77 @@ impl NodeBuilder {
104
104
///
105
105
/// If the given file does not exist a new random seed file will be generated and
106
106
/// 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 {
108
108
self . entropy_source_config = Some ( EntropySourceConfig :: SeedFile ( seed_path) ) ;
109
+ self
109
110
}
110
111
111
112
/// Configures the [`Node`] instance to source its wallet entropy from the given 64 seed bytes.
112
113
///
113
114
/// **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 {
115
116
if seed_bytes. len ( ) != WALLET_KEYS_SEED_LEN {
116
117
panic ! ( "Failed to set seed due to invalid length." ) ;
117
118
}
118
119
let mut bytes = [ 0u8 ; WALLET_KEYS_SEED_LEN ] ;
119
120
bytes. copy_from_slice ( & seed_bytes) ;
120
121
self . entropy_source_config = Some ( EntropySourceConfig :: SeedBytes ( bytes) ) ;
122
+ self
121
123
}
122
124
123
125
/// Configures the [`Node`] instance to source its wallet entropy from a [BIP 39] mnemonic.
124
126
///
125
127
/// [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 {
127
131
self . entropy_source_config =
128
132
Some ( EntropySourceConfig :: Bip39Mnemonic { mnemonic, passphrase } ) ;
133
+ self
129
134
}
130
135
131
136
/// 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 {
133
138
self . chain_data_source_config = Some ( ChainDataSourceConfig :: Esplora ( esplora_server_url) ) ;
139
+ self
134
140
}
135
141
136
142
/// Configures the [`Node`] instance to source its gossip data from the Lightning peer-to-peer
137
143
/// network.
138
- pub fn set_gossip_source_p2p ( & mut self ) {
144
+ pub fn set_gossip_source_p2p ( & mut self ) -> & mut Self {
139
145
self . gossip_source_config = Some ( GossipSourceConfig :: P2PNetwork ) ;
146
+ self
140
147
}
141
148
142
149
/// Configures the [`Node`] instance to source its gossip data from the given RapidGossipSync
143
150
/// 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 {
145
152
self . gossip_source_config = Some ( GossipSourceConfig :: RapidGossipSync ( rgs_server_url) ) ;
153
+ self
146
154
}
147
155
148
156
/// 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 {
150
158
self . config . storage_dir_path = storage_dir_path;
159
+ self
151
160
}
152
161
153
162
/// 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 {
155
164
self . config . network = network;
165
+ self
156
166
}
157
167
158
168
/// 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 {
160
170
self . config . listening_address = Some ( listening_address) ;
171
+ self
161
172
}
162
173
163
174
/// 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 {
165
176
self . config . log_level = level;
177
+ self
166
178
}
167
179
168
180
/// Builds a [`Node`] instance with a [`SqliteStore`] backend and according to the options
@@ -233,58 +245,58 @@ impl ArcedNodeBuilder {
233
245
/// If the given file does not exist a new random seed file will be generated and
234
246
/// stored at the given location.
235
247
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) ;
237
249
}
238
250
239
251
/// Configures the [`Node`] instance to source its wallet entropy from the given 64 seed bytes.
240
252
///
241
253
/// **Note:** Panics if the length of the given `seed_bytes` differs from 64.
242
254
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) ;
244
256
}
245
257
246
258
/// Configures the [`Node`] instance to source its wallet entropy from a [BIP 39] mnemonic.
247
259
///
248
260
/// [BIP 39]: https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki
249
261
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) ;
251
263
}
252
264
253
265
/// Configures the [`Node`] instance to source its chain data from the given Esplora server.
254
266
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) ;
256
268
}
257
269
258
270
/// Configures the [`Node`] instance to source its gossip data from the Lightning peer-to-peer
259
271
/// network.
260
272
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 ( ) ;
262
274
}
263
275
264
276
/// Configures the [`Node`] instance to source its gossip data from the given RapidGossipSync
265
277
/// server.
266
278
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) ;
268
280
}
269
281
270
282
/// Sets the used storage directory path.
271
283
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) ;
273
285
}
274
286
275
287
/// Sets the Bitcoin network used.
276
288
pub fn set_network ( & self , network : Network ) {
277
- self . inner . write ( ) . unwrap ( ) . set_network ( network)
289
+ self . inner . write ( ) . unwrap ( ) . set_network ( network) ;
278
290
}
279
291
280
292
/// Sets the IP address and TCP port on which [`Node`] will listen for incoming network connections.
281
293
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) ;
283
295
}
284
296
285
297
/// Sets the level at which [`Node`] will log messages.
286
298
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) ;
288
300
}
289
301
290
302
/// Builds a [`Node`] instance with a [`SqliteStore`] backend and according to the options
0 commit comments