hide sensitive data in STDOUT
This commit is contained in:
@@ -256,7 +256,7 @@ pub fn attempt_recover_seed(password: Option<String>) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
match LightClient::attempt_recover_seed(&config, password) {
|
match LightClient::attempt_recover_seed(&config, password) {
|
||||||
Ok(seed) => println!("Recovered seed: '{}'", seed),
|
Ok(_seed) => println!("Recovered seed "),
|
||||||
Err(e) => eprintln!("Failed to recover seed. Error: {}", e)
|
Err(e) => eprintln!("Failed to recover seed. Error: {}", e)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,10 +35,8 @@ mod danger {
|
|||||||
|
|
||||||
async fn get_client(uri: &http::Uri, no_cert: bool) -> Result<CompactTxStreamerClient<Channel>, Box<dyn std::error::Error>> {
|
async fn get_client(uri: &http::Uri, no_cert: bool) -> Result<CompactTxStreamerClient<Channel>, Box<dyn std::error::Error>> {
|
||||||
let channel = if uri.scheme_str() == Some("http") {
|
let channel = if uri.scheme_str() == Some("http") {
|
||||||
//println!("http");
|
|
||||||
Channel::builder(uri.clone()).connect().await?
|
Channel::builder(uri.clone()).connect().await?
|
||||||
} else {
|
} else {
|
||||||
//println!("https");
|
|
||||||
let mut config = ClientConfig::new();
|
let mut config = ClientConfig::new();
|
||||||
|
|
||||||
config.alpn_protocols.push(b"h2".to_vec());
|
config.alpn_protocols.push(b"h2".to_vec());
|
||||||
@@ -124,7 +122,7 @@ where F : Fn(&[u8], u64) {
|
|||||||
let mut encoded_buf = vec![];
|
let mut encoded_buf = vec![];
|
||||||
|
|
||||||
if let Err(e) = block.encode(&mut encoded_buf) {
|
if let Err(e) = block.encode(&mut encoded_buf) {
|
||||||
eprintln!("Error encoding block: {:?}", e);
|
error!("Error encoding block: {:?}", e);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +130,7 @@ where F : Fn(&[u8], u64) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Err(e) = ftx.send(Ok(())) {
|
if let Err(e) = ftx.send(Ok(())) {
|
||||||
eprintln!("Error sending completion signal: {:?}", e);
|
error!("Error sending completion signal: {:?}", e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -140,13 +138,13 @@ where F : Fn(&[u8], u64) {
|
|||||||
|
|
||||||
while let Some(block) = response.message().await? {
|
while let Some(block) = response.message().await? {
|
||||||
if let Err(e) = tx.send(Some(block)) {
|
if let Err(e) = tx.send(Some(block)) {
|
||||||
eprintln!("Error sending block to channel: {:?}", e);
|
error!("Error sending block to channel: {:?}", e);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(e) = tx.send(None) {
|
if let Err(e) = tx.send(None) {
|
||||||
eprintln!("Error sending end signal to channel: {:?}", e);
|
error!("Error sending end signal to channel: {:?}", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
frx.iter().take(1).collect::<Result<Vec<()>, String>>()?;
|
frx.iter().take(1).collect::<Result<Vec<()>, String>>()?;
|
||||||
@@ -191,7 +189,7 @@ where F : Fn(&[u8], u64) {
|
|||||||
let mut client = match get_client(uri, no_cert).await {
|
let mut client = match get_client(uri, no_cert).await {
|
||||||
Ok(client) => client,
|
Ok(client) => client,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!("Error creating client: {:?}", e);
|
error!("Error creating client: {:?}", e);
|
||||||
return Err(e.into());
|
return Err(e.into());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -204,7 +202,7 @@ where F : Fn(&[u8], u64) {
|
|||||||
let maybe_response = match client.get_address_txids(request).await {
|
let maybe_response = match client.get_address_txids(request).await {
|
||||||
Ok(response) => response,
|
Ok(response) => response,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!("Error getting address txids: {:?}", e);
|
error!("Error getting address txids: {:?}", e);
|
||||||
return Err(e.into());
|
return Err(e.into());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -355,14 +353,14 @@ pub fn fetch_latest_block(uri: &http::Uri, no_cert: bool) -> Result<BlockId, Str
|
|||||||
Ok(r) => r,
|
Ok(r) => r,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
let errstr = format!("Error creating runtime {}", e.to_string());
|
let errstr = format!("Error creating runtime {}", e.to_string());
|
||||||
eprintln!("{}", errstr);
|
error!("{}", errstr);
|
||||||
return Err(errstr);
|
return Err(errstr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
rt.block_on(get_latest_block(uri, no_cert)).map_err(|e| {
|
rt.block_on(get_latest_block(uri, no_cert)).map_err(|e| {
|
||||||
let errstr = format!("Error getting latest block {}", e.to_string());
|
let errstr = format!("Error getting latest block {}", e.to_string());
|
||||||
eprintln!("{}", errstr);
|
error!("{}", errstr);
|
||||||
errstr
|
errstr
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -449,11 +449,11 @@ impl LightClient {
|
|||||||
sync_status : Arc::new(RwLock::new(WalletStatus::new())),
|
sync_status : Arc::new(RwLock::new(WalletStatus::new())),
|
||||||
};
|
};
|
||||||
|
|
||||||
println!("Setting birthday to {}", birthday);
|
|
||||||
l.set_wallet_initial_state(birthday);
|
l.set_wallet_initial_state(birthday);
|
||||||
#[cfg(feature = "embed_params")]
|
#[cfg(feature = "embed_params")]
|
||||||
l.read_sapling_params();
|
l.read_sapling_params();
|
||||||
println!("Setting Number to {}", number);
|
|
||||||
|
|
||||||
info!("Created new wallet!");
|
info!("Created new wallet!");
|
||||||
info!("Created LightClient to {}", &config.server);
|
info!("Created LightClient to {}", &config.server);
|
||||||
@@ -1233,7 +1233,7 @@ pub fn start_mempool_monitor(lc: Arc<LightClient>) -> Result<(), String> {
|
|||||||
}
|
}
|
||||||
// Sleep exponentially backing off
|
// Sleep exponentially backing off
|
||||||
std::thread::sleep(std::time::Duration::from_secs((2 as u64).pow(retry_count)));
|
std::thread::sleep(std::time::Duration::from_secs((2 as u64).pow(retry_count)));
|
||||||
// println!("Sync error {}\nRetry count {}", e, retry_count);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1393,7 +1393,7 @@ pub fn start_mempool_monitor(lc: Arc<LightClient>) -> Result<(), String> {
|
|||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
// println!("Total scan duration: {:?}", self.wallet.read().unwrap().total_scan_duration.read().unwrap().get(0).unwrap().as_millis());
|
|
||||||
|
|
||||||
let t = self.wallet.read().unwrap();
|
let t = self.wallet.read().unwrap();
|
||||||
let mut d = t.total_scan_duration.write().unwrap();
|
let mut d = t.total_scan_duration.write().unwrap();
|
||||||
@@ -1529,17 +1529,17 @@ pub fn start_mempool_monitor(lc: Arc<LightClient>) -> Result<(), String> {
|
|||||||
w.scan_full_tx(&tx, height as i32, datetime as u64);
|
w.scan_full_tx(&tx, height as i32, datetime as u64);
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("Error reading wallet: {}", e);
|
error!("Error reading wallet: {}", e);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("Error processing transaction: {}", e);
|
error!("Error processing transaction: {}", e);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("Error reading transaction: {}", e);
|
error!("Error reading transaction: {}", e);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1547,7 +1547,7 @@ pub fn start_mempool_monitor(lc: Arc<LightClient>) -> Result<(), String> {
|
|||||||
|
|
||||||
match ctx.send(r) {
|
match ctx.send(r) {
|
||||||
Ok(_) => info!("Successfully sent data for address: {}", address_clone),
|
Ok(_) => info!("Successfully sent data for address: {}", address_clone),
|
||||||
Err(e) => println!("Failed to send data for address: {}: {:?}", address_clone, e),
|
Err(e) => error!("Failed to send data for address: {}: {:?}", address_clone, e),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user