mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-10 23:27:56 -05:00
remove wallet path in gatewayd, darkfid, and cashierd
This commit is contained in:
@@ -43,23 +43,18 @@ async fn start(executor: Arc<Executor<'_>>, config: Arc<CashierdConfig>) -> Resu
|
||||
|
||||
let gateway_addr: SocketAddr = config.gateway_url.parse()?;
|
||||
|
||||
let btc_endpoint: (bool, String) = if config.btc_testnet {
|
||||
( true, config.btc_testnet_endpoint.clone() )
|
||||
}
|
||||
else {
|
||||
( false, config.btc_mainnet_endpoint.clone() )
|
||||
};
|
||||
let database_path = join_config_path(&PathBuf::from("cashier_client_database.db"))?;
|
||||
|
||||
let database_path = config.client_database_path.clone();
|
||||
let database_path = join_config_path(&PathBuf::from(database_path))?;
|
||||
let cashierdb = join_config_path(&PathBuf::from("cashier.db"))?;
|
||||
let client_wallet = join_config_path(&PathBuf::from("cashier_client_walletdb.db"))?;
|
||||
|
||||
let wallet = CashierDb::new(
|
||||
&PathBuf::from(&config.cashierdb_path),
|
||||
&cashierdb.clone(),
|
||||
config.password.clone(),
|
||||
)?;
|
||||
|
||||
let client_wallet = WalletDb::new(
|
||||
&PathBuf::from(&config.client_walletdb_path),
|
||||
&client_wallet.clone(),
|
||||
config.client_password.clone(),
|
||||
)?;
|
||||
|
||||
@@ -82,7 +77,7 @@ async fn start(executor: Arc<Executor<'_>>, config: Arc<CashierdConfig>) -> Resu
|
||||
let asset_id = deserialize(&asset.id)?;
|
||||
|
||||
// TODO: pass vector of assets into cashier.start()
|
||||
cashier.start(ex.clone(), btc_endpoint, asset_id).await?;
|
||||
cashier.start(ex.clone(), asset_id).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -17,12 +17,10 @@ async fn start(executor: Arc<Executor<'_>>, config: Arc<DarkfidConfig>) -> Resul
|
||||
let connect_addr: SocketAddr = config.connect_url.parse()?;
|
||||
let sub_addr: SocketAddr = config.subscriber_url.parse()?;
|
||||
let cashier_addr: SocketAddr = config.cashier_url.parse()?;
|
||||
let database_path = config.database_path.clone();
|
||||
let walletdb_path = config.walletdb_path.clone();
|
||||
let rpc_url: std::net::SocketAddr = config.rpc_url.parse()?;
|
||||
|
||||
let database_path = join_config_path(&PathBuf::from(database_path))?;
|
||||
let walletdb_path = join_config_path(&PathBuf::from(walletdb_path))?;
|
||||
let database_path = join_config_path(&PathBuf::from("database_client.db"))?;
|
||||
let walletdb_path = join_config_path(&PathBuf::from("walletdb.db"))?;
|
||||
|
||||
let rocks = Rocks::new(&database_path)?;
|
||||
|
||||
|
||||
@@ -15,8 +15,7 @@ use easy_parallel::Parallel;
|
||||
async fn start(executor: Arc<Executor<'_>>, config: Arc<&GatewaydConfig>) -> Result<()> {
|
||||
let accept_addr: SocketAddr = config.accept_url.parse()?;
|
||||
let pub_addr: SocketAddr = config.publisher_url.parse()?;
|
||||
let database_path = config.database_path.clone();
|
||||
let database_path = join_config_path(&PathBuf::from(database_path))?;
|
||||
let database_path = join_config_path(&PathBuf::from("gatewayd.db"))?;
|
||||
|
||||
let rocks = Rocks::new(&database_path)?;
|
||||
let rocks_slabstore_column = RocksColumn::<columns::Slabs>::new(rocks);
|
||||
@@ -31,7 +30,7 @@ fn main() -> Result<()> {
|
||||
let ex = Arc::new(Executor::new());
|
||||
let (signal, shutdown) = async_channel::unbounded::<()>();
|
||||
|
||||
let path = join_config_path(&PathBuf::from("gatewayd.toml")).unwrap();
|
||||
let path = join_config_path(&PathBuf::from("gatewayd.toml"))?;
|
||||
|
||||
let config: GatewaydConfig = Config::<GatewaydConfig>::load(path)?;
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ impl<T: Serialize + DeserializeOwned> Config<T> {
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct DrkConfig {
|
||||
pub rpc_url: String,
|
||||
|
||||
pub log_path: String,
|
||||
}
|
||||
|
||||
@@ -49,12 +48,6 @@ pub struct DarkfidConfig {
|
||||
#[serde(rename = "rpc_url")]
|
||||
pub rpc_url: String,
|
||||
|
||||
#[serde(rename = "database_path")]
|
||||
pub database_path: String,
|
||||
|
||||
#[serde(rename = "walletdb_path")]
|
||||
pub walletdb_path: String,
|
||||
|
||||
#[serde(rename = "log_path")]
|
||||
pub log_path: String,
|
||||
|
||||
@@ -70,9 +63,6 @@ pub struct GatewaydConfig {
|
||||
#[serde(rename = "publisher_url")]
|
||||
pub publisher_url: String,
|
||||
|
||||
#[serde(rename = "database_path")]
|
||||
pub database_path: String,
|
||||
|
||||
#[serde(rename = "log_path")]
|
||||
pub log_path: String,
|
||||
}
|
||||
@@ -85,33 +75,15 @@ pub struct CashierdConfig {
|
||||
#[serde(rename = "rpc_url")]
|
||||
pub rpc_url: String,
|
||||
|
||||
#[serde(rename = "client_database_path")]
|
||||
pub client_database_path: String,
|
||||
|
||||
#[serde(rename = "gateway_url")]
|
||||
pub gateway_url: String,
|
||||
|
||||
#[serde(rename = "log_path")]
|
||||
pub log_path: String,
|
||||
|
||||
#[serde(rename = "cashierdb_path")]
|
||||
pub cashierdb_path: String,
|
||||
|
||||
#[serde(rename = "client_walletdb_path")]
|
||||
pub client_walletdb_path: String,
|
||||
|
||||
#[serde(rename = "password")]
|
||||
pub password: String,
|
||||
|
||||
#[serde(rename = "client_password")]
|
||||
pub client_password: String,
|
||||
|
||||
#[serde(rename = "btc_testnet")]
|
||||
pub btc_testnet: bool,
|
||||
|
||||
#[serde(rename = "btc_mainnet_endpoint")]
|
||||
pub btc_mainnet_endpoint: String,
|
||||
|
||||
#[serde(rename = "btc_testnet_endpoint")]
|
||||
pub btc_testnet_endpoint: String,
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@ use async_std::sync::{Arc, Mutex};
|
||||
use std::net::SocketAddr;
|
||||
use std::path::PathBuf;
|
||||
|
||||
|
||||
|
||||
#[repr(u8)]
|
||||
enum CashierError {
|
||||
NoError,
|
||||
@@ -44,14 +42,12 @@ impl CashierService {
|
||||
gateway_addrs: (SocketAddr, SocketAddr),
|
||||
params_paths: (PathBuf, PathBuf),
|
||||
) -> Result<CashierService> {
|
||||
|
||||
let rocks = Rocks::new(&cashier_database_path)?;
|
||||
|
||||
let client = Client::new(rocks, gateway_addrs, params_paths, client_wallet.clone())?;
|
||||
|
||||
let client = Arc::new(Mutex::new(client));
|
||||
|
||||
|
||||
Ok(CashierService {
|
||||
addr,
|
||||
wallet,
|
||||
@@ -61,8 +57,6 @@ impl CashierService {
|
||||
pub async fn start(
|
||||
&mut self,
|
||||
executor: Arc<Executor<'_>>,
|
||||
// TODO: the endpoint should be generic according to asset_id
|
||||
btc_endpoint: (bool, String),
|
||||
// TODO: make this a vector of assets
|
||||
asset_id: jubjub::Fr,
|
||||
) -> Result<()> {
|
||||
@@ -81,6 +75,10 @@ impl CashierService {
|
||||
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "default")]{
|
||||
// TODO: the endpoint should be generic according to asset_id
|
||||
let btc_endpoint: (bool, String) =
|
||||
(true, String::from("tcp://electrum.blockstream.info:60001"));
|
||||
|
||||
let btc_client = super::btc::BtcClient::new(btc_endpoint)?;
|
||||
bridge.clone().add_clients(asset_id, Arc::new(btc_client)).await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user