Merge pull request 'Merge dev into main' (#30) from dev into master
Reviewed-on: https://git.hush.is/hush/silentdragonlite-cli/pulls/30
This commit is contained in:
@@ -256,7 +256,7 @@ pub fn attempt_recover_seed(password: Option<String>) {
|
||||
};
|
||||
|
||||
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)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -35,10 +35,8 @@ mod danger {
|
||||
|
||||
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") {
|
||||
//println!("http");
|
||||
Channel::builder(uri.clone()).connect().await?
|
||||
} else {
|
||||
//println!("https");
|
||||
let mut config = ClientConfig::new();
|
||||
|
||||
config.alpn_protocols.push(b"h2".to_vec());
|
||||
@@ -124,7 +122,7 @@ where F : Fn(&[u8], u64) {
|
||||
let mut encoded_buf = vec![];
|
||||
|
||||
if let Err(e) = block.encode(&mut encoded_buf) {
|
||||
eprintln!("Error encoding block: {:?}", e);
|
||||
error!("Error encoding block: {:?}", e);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -132,7 +130,7 @@ where F : Fn(&[u8], u64) {
|
||||
}
|
||||
|
||||
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? {
|
||||
if let Err(e) = tx.send(Some(block)) {
|
||||
eprintln!("Error sending block to channel: {:?}", e);
|
||||
error!("Error sending block to channel: {:?}", e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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>>()?;
|
||||
@@ -191,7 +189,7 @@ where F : Fn(&[u8], u64) {
|
||||
let mut client = match get_client(uri, no_cert).await {
|
||||
Ok(client) => client,
|
||||
Err(e) => {
|
||||
eprintln!("Error creating client: {:?}", e);
|
||||
error!("Error creating client: {:?}", e);
|
||||
return Err(e.into());
|
||||
}
|
||||
};
|
||||
@@ -204,7 +202,7 @@ where F : Fn(&[u8], u64) {
|
||||
let maybe_response = match client.get_address_txids(request).await {
|
||||
Ok(response) => response,
|
||||
Err(e) => {
|
||||
eprintln!("Error getting address txids: {:?}", e);
|
||||
error!("Error getting address txids: {:?}", e);
|
||||
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,
|
||||
Err(e) => {
|
||||
let errstr = format!("Error creating runtime {}", e.to_string());
|
||||
eprintln!("{}", errstr);
|
||||
error!("{}", errstr);
|
||||
return Err(errstr);
|
||||
}
|
||||
};
|
||||
|
||||
rt.block_on(get_latest_block(uri, no_cert)).map_err(|e| {
|
||||
let errstr = format!("Error getting latest block {}", e.to_string());
|
||||
eprintln!("{}", errstr);
|
||||
error!("{}", errstr);
|
||||
errstr
|
||||
})
|
||||
}
|
||||
|
||||
@@ -449,11 +449,11 @@ impl LightClient {
|
||||
sync_status : Arc::new(RwLock::new(WalletStatus::new())),
|
||||
};
|
||||
|
||||
println!("Setting birthday to {}", birthday);
|
||||
// println!("Setting birthday to {}", birthday);
|
||||
l.set_wallet_initial_state(birthday);
|
||||
#[cfg(feature = "embed_params")]
|
||||
l.read_sapling_params();
|
||||
println!("Setting Number to {}", number);
|
||||
|
||||
|
||||
info!("Created new wallet!");
|
||||
info!("Created LightClient to {}", &config.server);
|
||||
@@ -1233,7 +1233,7 @@ pub fn start_mempool_monitor(lc: Arc<LightClient>) -> Result<(), String> {
|
||||
}
|
||||
// Sleep exponentially backing off
|
||||
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 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);
|
||||
},
|
||||
Err(e) => {
|
||||
println!("Error reading wallet: {}", e);
|
||||
error!("Error reading wallet: {}", e);
|
||||
},
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
println!("Error processing transaction: {}", e);
|
||||
error!("Error processing transaction: {}", 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) {
|
||||
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),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -498,6 +498,9 @@ fn get_main_checkpoint(height: u64) -> Option<(u64, &'static str, &'static str)
|
||||
(1650000,"00000000922fca1c2ab235f6592387433c0622665408caf1a689d588acd7ef4a",
|
||||
"014a43866e55370ba3daa33649d975d748cc12c1ef3580cf0c93b424238fc2b2360015018ceaeea4244a4e58fb01160f29684fef2ec344bb2a7ddf852188720593627b5801659c17e9ef2b5e45b9e55d676c5ce5f9c8b193d41abefd02adc1fdf3372eef610001689605287033ba0551e500645d7b1a41d591ae4158ddc3671da0137da00bf86500000000012da2eae775f2bba0ff79df96b7759b5e93a03d02ca6c89603fa55e80215dda5b01ec4fc9be82884f1e6a324d5e8370b1b70714ea38235b90dec6b019f466f7ef5d0001b8dab7fd26bf4cae166a75905d75e88a40ce11773afe2b1363fc793df97934580001fefbd39896743ba6d44d4ac57a51044ed6384aec3c9c76b92131713918bfd0350001c2b480770a4ed4aa312595eba91cb25a5e4cb4dd368b51f0d639f866a23fe12e000001491139c6c100cdd9176607c63fa695709727d919634d2983a9412c3010ed6d3d01708c9850eb440b259f233187662c5228804cb4500263949301b6fac8f6428f2301d6f84c424acdb1d10f8cef641662e0f63f954f07fe6199d504a61979c9ba3e13"
|
||||
),
|
||||
(1660000,"000000049e13deb195724e2a64bf4d7a476b44d67d9779a321cdc32f2363c691",
|
||||
"01cb9d65145e177f4edaa867152496fe578e0b675a9956aced17f05d2318f75a420015000149966715a2721675404ad33ef711a014b406e0dc8ed916a2f6d61c4f651baf5101cacc35ab88444d2f0699ff6e6bd4939467fe775bac54651cce3857a00145e5420162a7c7432b7ccf2bd139461b0a3df15bb204172cd94353cc3c9204d443c7de7101d29d5ebe0472ab19950a9cee3049c7586be604f27d0171e440b7530599d9111a01b6d92b1466059158ce46405ccbed25f586ecac3b2e5415701d67a1b9cb0b31390105d4f83f83045db4f745e75fc33d5af26972d7c13e1efc45a7557db3c60e4b480001cf3ac4ef2f5a3580493a72037dad12070903208a2ba9c5bd5c3101dd8218d86401e8a3186dacf0f4351aa958bf78a20cc4414f1d5335a0d500d09b20d3e613e6690000010f7cd04cccbf26f8d8645f3c6c939067bb16cae9c826d0b68819f3e6bc745e2d01fefbd39896743ba6d44d4ac57a51044ed6384aec3c9c76b92131713918bfd0350001c2b480770a4ed4aa312595eba91cb25a5e4cb4dd368b51f0d639f866a23fe12e000001491139c6c100cdd9176607c63fa695709727d919634d2983a9412c3010ed6d3d01708c9850eb440b259f233187662c5228804cb4500263949301b6fac8f6428f2301d6f84c424acdb1d10f8cef641662e0f63f954f07fe6199d504a61979c9ba3e13"
|
||||
),
|
||||
];
|
||||
|
||||
find_checkpoint(height, checkpoints)
|
||||
|
||||
Reference in New Issue
Block a user