bitceptron_retriever/client/
client_setting.rs

1use getset::Getters;
2use zeroize::{Zeroize, ZeroizeOnDrop};
3
4/// Settings used for creating a bitcoincore rpc client.
5#[derive(Debug, Zeroize, ZeroizeOnDrop, Getters, Default, Clone)]
6#[get = "pub with_prefix"]
7pub struct ClientSetting {
8    rpc_url: String,
9    rpc_port: String,
10    /// Usually resides in the datadir of your bitcoin setup (.bitcoin folder).
11    cookie_path: String,
12    /// This is the time period in which the rpc connection stays alive despite not receiving a response from bitcoincore.
13    /// It is important to set this high enough for creating a utxo set dump or scanning the utxo set takes more than the default 15 seconds.
14    timeout_seconds: u64,
15}
16
17impl ClientSetting {
18    pub fn new(rpc_url: &str, rpc_port: &str, cookie_path: &str, timeout_seconds: u64) -> Self {
19        ClientSetting {
20            rpc_url: rpc_url.to_string(),
21            rpc_port: rpc_port.to_string(),
22            cookie_path: cookie_path.to_string(),
23            timeout_seconds,
24        }
25    }
26}