summaryrefslogtreecommitdiff
path: root/eth-wire
diff options
context:
space:
mode:
authorAntoine A <>2022-03-02 21:09:03 +0100
committerAntoine A <>2022-03-02 21:09:03 +0100
commit96ade12275de36f3ea9f771c9fe6ba6eb4a8f52c (patch)
treeaff284772d65642c5ac4cbd6c0c468f34e47a0e6 /eth-wire
parent8880a7d5254601bff6ff52aee96a174bb503759d (diff)
downloaddepolymerization-96ade12275de36f3ea9f771c9fe6ba6eb4a8f52c.tar.gz
depolymerization-96ade12275de36f3ea9f771c9fe6ba6eb4a8f52c.tar.bz2
depolymerization-96ade12275de36f3ea9f771c9fe6ba6eb4a8f52c.zip
Better config format error msg
Diffstat (limited to 'eth-wire')
-rw-r--r--eth-wire/src/bin/eth-wire-utils.rs4
-rw-r--r--eth-wire/src/main.rs13
2 files changed, 10 insertions, 7 deletions
diff --git a/eth-wire/src/bin/eth-wire-utils.rs b/eth-wire/src/bin/eth-wire-utils.rs
index 7578ced..e64d089 100644
--- a/eth-wire/src/bin/eth-wire-utils.rs
+++ b/eth-wire/src/bin/eth-wire-utils.rs
@@ -26,7 +26,7 @@ use common::{
config::{Config, CoreConfig},
log::init,
password,
- postgres::{Client, NoTls},
+ postgres::NoTls,
rand_slice,
};
use eth_wire::{
@@ -175,7 +175,7 @@ fn main() {
}
Cmd::Resetdb => {
let block = rpc.earliest_block().unwrap();
- let mut db = Client::connect(&config.unwrap().db_url, NoTls).unwrap();
+ let mut db = config.unwrap().db_config.connect(NoTls).unwrap();
let mut tx = db.transaction().unwrap();
// Clear transaction tables and reset state
tx.execute("DELETE FROM tx_in", &[]).unwrap();
diff --git a/eth-wire/src/main.rs b/eth-wire/src/main.rs
index 694c8db..91dc4d7 100644
--- a/eth-wire/src/main.rs
+++ b/eth-wire/src/main.rs
@@ -20,7 +20,7 @@ use clap::StructOpt;
use common::{
config::{load_eth_config, Config, CoreConfig},
named_spawn, password,
- postgres::{Client, NoTls},
+ postgres::NoTls,
reconnect::auto_reconnect_db,
};
use eth_wire::{
@@ -66,7 +66,10 @@ fn init(config: Option<PathBuf>, init: Init) {
// Parse taler config
let config = CoreConfig::load_taler_config(config.as_deref(), Some("ETH"));
// Connect to database
- let mut db = Client::connect(&config.db_url, NoTls).expect("Failed to connect to database");
+ let mut db = config
+ .db_config
+ .connect(NoTls)
+ .expect("Failed to connect to database");
// Connect to ethereum node
let mut rpc = Rpc::new(
config
@@ -183,9 +186,9 @@ fn run(config: Option<PathBuf>) {
.unwrap_or(PathBuf::from("/tmp/")),
);
- let db_watcher = auto_reconnect_db(state.config.core.db_url.clone());
- let db_analysis = auto_reconnect_db(state.config.core.db_url.clone());
- let db_worker = auto_reconnect_db(state.config.core.db_url.clone());
+ let db_watcher = auto_reconnect_db(state.config.core.db_config.clone());
+ let db_analysis = auto_reconnect_db(state.config.core.db_config.clone());
+ let db_worker = auto_reconnect_db(state.config.core.db_config.clone());
named_spawn("watcher", move || watcher(rpc_watcher, db_watcher));
named_spawn("analysis", move || {