bugdfix
This commit is contained in:
parent
fe1c4ee2c8
commit
2234bb9147
@ -147,7 +147,10 @@ fn get_client_from_cookie(url: &String,network: &NetworkParams)->Result<(Client,
|
||||
match Client::new(&url[..], Auth::CookieFile(cookie.into())) {
|
||||
Ok(client) => {
|
||||
match client.get_blockchain_info(){
|
||||
Ok(bcinfo) => Ok((client,bcinfo)),
|
||||
Ok(bcinfo) => {
|
||||
println!("cristoporco");
|
||||
Ok((client,bcinfo))
|
||||
},
|
||||
Err(err) => {
|
||||
Err(err.into())
|
||||
}
|
||||
|
||||
@ -117,13 +117,13 @@ async fn echo_info(
|
||||
info!("echo info!!!{}",param);
|
||||
let netconfig=MyConfig::get_net_config(cfg,param);
|
||||
if !netconfig.enabled {
|
||||
trace!("network disabled");
|
||||
debug!("network disabled {}",param);
|
||||
return Ok(Response::new(full("network disabled")));
|
||||
}
|
||||
let address = match netconfig.xpub{
|
||||
false => {
|
||||
let address = netconfig.address.to_string();
|
||||
info!("is address: {}",&address);
|
||||
trace!("is address: {}",&address);
|
||||
address
|
||||
},
|
||||
true => {
|
||||
@ -134,8 +134,8 @@ async fn echo_info(
|
||||
let next = get_next_address_index(&db,&netconfig.name,&netconfig.address);
|
||||
let address = new_address_from_xpub(&netconfig.address,next.1,netconfig.network).unwrap();
|
||||
save_new_address(&db,next.0,&address.0,&address.1,&remote_addr);
|
||||
debug!("address {} {}",address.0,address.1);
|
||||
debug!("next {} {}",next.0,next.1);
|
||||
debug!("save new address {} {}",address.0,address.1);
|
||||
trace!("next {} {}",next.0,next.1);
|
||||
address.0
|
||||
}
|
||||
}
|
||||
@ -151,7 +151,10 @@ async fn echo_info(
|
||||
};
|
||||
trace!("address: {:#?}",info);
|
||||
match serde_json::to_string(&info){
|
||||
Ok(json_data) => Ok(Response::new(full(json_data))),
|
||||
Ok(json_data) => {
|
||||
debug!("echo info reply: {}", json_data);
|
||||
return Ok(Response::new(full(json_data)));
|
||||
},
|
||||
Err(err) => Ok(Response::new(full(format!("error:{}",err))))
|
||||
}
|
||||
|
||||
@ -458,23 +461,30 @@ fn full<T: Into<Bytes>>(chunk: T) -> BoxBody<Bytes, hyper::Error> {
|
||||
.boxed()
|
||||
}
|
||||
fn parse_env(cfg: &Arc<Mutex<MyConfig>>){
|
||||
for (key, value) in std::env::vars() {
|
||||
debug!("ENVIRONMENT {key}: {value}");
|
||||
}
|
||||
let mut cfg_lock = cfg.lock().unwrap();
|
||||
if let Ok(value) = env::var("BAL_SERVER_DB_FILE") {
|
||||
debug!("BAL_SERVER_DB_FILE: {}",value);
|
||||
cfg_lock.db_file = value;
|
||||
}
|
||||
if let Ok(value) = env::var("BAL_SERVER_BIND_ADDRESS") {
|
||||
debug!("BAL_SERVER_BIND_ADDRESS: {}",value);
|
||||
cfg_lock.bind_address= value;
|
||||
}
|
||||
if let Ok(value) = env::var("BAL_SERVER_BIND_PORT") {
|
||||
debug!("BAL_SERVER_BIND_PORT: {}",value);
|
||||
if let Ok(v) = value.parse::<u16>(){
|
||||
cfg_lock.bind_port = v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if let Ok(value) = env::var("BAL_SERVER_INFO"){
|
||||
debug!("BAL_SERVER_INFO: {}",value);
|
||||
cfg_lock.info = value;
|
||||
}
|
||||
|
||||
cfg_lock = parse_env_netconfig(cfg_lock,"regtest");
|
||||
cfg_lock = parse_env_netconfig(cfg_lock,"signet");
|
||||
cfg_lock = parse_env_netconfig(cfg_lock,"testnet");
|
||||
@ -489,6 +499,7 @@ fn parse_env_netconfig<'a>(mut cfg_lock: MutexGuard<'a, MyConfig>, chain: &'a st
|
||||
&_ => &mut cfg_lock.mainnet,
|
||||
};
|
||||
if let Ok(value) = env::var(format!("BAL_SERVER_{}_ADDRESS",chain.to_uppercase())) {
|
||||
debug!("BAL_SERVER_{}_ADDRESS: {}",chain.to_uppercase(),value);
|
||||
cfg.address = value;
|
||||
if cfg.address.len() > 5 {
|
||||
if cfg.address[1..4] == *"pub" {
|
||||
@ -500,6 +511,7 @@ fn parse_env_netconfig<'a>(mut cfg_lock: MutexGuard<'a, MyConfig>, chain: &'a st
|
||||
}
|
||||
|
||||
if let Ok(value) = env::var(format!("BAL_SERVER_{}_FIXED_FEE",chain.to_uppercase())) {
|
||||
debug!("BAL_SERVER_{}_FIXED_FEE: {}",chain.to_uppercase(),value);
|
||||
if let Ok(v) = value.parse::<u64>(){
|
||||
cfg.fixed_fee = v;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user