Add some better logging for get_outputs_by_id failure states (#2705)

This commit is contained in:
Mark Renten 2019-03-25 10:17:47 -04:00 committed by hashmap
parent 3566da2434
commit c3cd98cae7
4 changed files with 20 additions and 12 deletions

View file

@ -203,8 +203,9 @@ fn send_request_async(req: Request<Body>) -> Box<dyn Future<Item = String, Error
.and_then(|resp| { .and_then(|resp| {
if !resp.status().is_success() { if !resp.status().is_success() {
Either::A(err(ErrorKind::RequestError(format!( Either::A(err(ErrorKind::RequestError(format!(
"Wrong response code: {}", "Wrong response code: {} with data {:?}",
resp.status() resp.status(),
resp.body()
)) ))
.into())) .into()))
} else { } else {

View file

@ -106,9 +106,13 @@ impl OutputHandler {
let mut outputs: Vec<Output> = vec![]; let mut outputs: Vec<Output> = vec![];
for x in commitments { for x in commitments {
if let Ok(output) = self.get_output(&x) { match self.get_output(&x) {
outputs.push(output); Ok(output) => outputs.push(output),
} Err(e) => error!(
"Failure to get output for commitment {} with error {}",
x, e
),
};
} }
Ok(outputs) Ok(outputs)
} }

View file

@ -355,12 +355,12 @@ mod test {
// Cuckatoo 31 Solution for Header [0u8;80] - nonce 99 // Cuckatoo 31 Solution for Header [0u8;80] - nonce 99
static V1_31: [u64; 42] = [ static V1_31: [u64; 42] = [
0x1128e07, 0xc181131, 0x110fad36, 0x1135ddee, 0x1669c7d3, 0x1931e6ea, 0x1c0005f3, 0x1dd6ecca, 0x1128e07, 0xc181131, 0x110fad36, 0x1135ddee, 0x1669c7d3, 0x1931e6ea, 0x1c0005f3,
0x1e29ce7e, 0x209736fc, 0x2692bf1a, 0x27b85aa9, 0x29bb7693, 0x2dc2a047, 0x2e28650a, 0x2f381195, 0x1dd6ecca, 0x1e29ce7e, 0x209736fc, 0x2692bf1a, 0x27b85aa9, 0x29bb7693, 0x2dc2a047,
0x350eb3f9, 0x3beed728, 0x3e861cbc, 0x41448cc1, 0x41f08f6d, 0x42fbc48a, 0x4383ab31, 0x4389c61f, 0x2e28650a, 0x2f381195, 0x350eb3f9, 0x3beed728, 0x3e861cbc, 0x41448cc1, 0x41f08f6d,
0x4540a5ce, 0x49a17405, 0x50372ded, 0x512f0db0, 0x588b6288, 0x5a36aa46, 0x5c29e1fe, 0x6118ab16, 0x42fbc48a, 0x4383ab31, 0x4389c61f, 0x4540a5ce, 0x49a17405, 0x50372ded, 0x512f0db0,
0x634705b5, 0x6633d190, 0x6683782f, 0x6728b6e1, 0x67adfb45, 0x68ae2306, 0x6d60f5e1, 0x78af3c4f, 0x588b6288, 0x5a36aa46, 0x5c29e1fe, 0x6118ab16, 0x634705b5, 0x6633d190, 0x6683782f,
0x7dde51ab, 0x7faced21 0x6728b6e1, 0x67adfb45, 0x68ae2306, 0x6d60f5e1, 0x78af3c4f, 0x7dde51ab, 0x7faced21,
]; ];
#[test] #[test]

View file

@ -857,7 +857,10 @@ where
let parent_key_id = w.parent_key_id(); let parent_key_id = w.parent_key_id();
match updater::refresh_outputs(&mut *w, &parent_key_id, update_all) { match updater::refresh_outputs(&mut *w, &parent_key_id, update_all) {
Ok(_) => true, Ok(_) => true,
Err(_) => false, Err(e) => {
error!("failed to refresh outputs for wallet with error : {:?}", e);
false
}
} }
} }
} }