self.index_runes_pre_alpha_i_agree_to_get_rekt && self.chain() != Chain::Mainnet
}
pub(crate) fn rpc_url(&self) -> String {
if let Some(rpc_url) = &self.rpc_url {
format!("{rpc_url}/wallet/{}", self.wallet)
} else {
format!(
"127.0.0.1:{}/wallet/{}",
self.chain().default_rpc_port(),
self.wallet
)
}
}
pub(crate) fn cookie_file(&self) -> Result<PathBuf> {
if let Some(cookie_file) = &self.cookie_file {
return Ok(cookie_file.clone());
}
let path = if let Some(bitcoin_data_dir) = &self.bitcoin_data_dir {
bitcoin_data_dir.clone()
} else if cfg!(target_os = "linux") {
dirs::home_dir()
.ok_or_else(|| anyhow!("failed to get cookie file path: could not get home dir"))?
.join(".bitcoin")
} else {
dirs::data_dir()
.ok_or_else(|| anyhow!("failed to get cookie file path: could not get data dir"))?
.join("Bitcoin")
};
let path = self.chain().join_with_data_dir(&path);
Ok(path.join(".cookie"))