From 8077d0100450e71806bf69ffdf18f986874e9ca4 Mon Sep 17 00:00:00 2001 From: Antioch Peverell Date: Mon, 14 Sep 2020 12:17:12 +0100 Subject: [PATCH] we expect unspent outputs but play it safe (#517) --- impls/src/node_clients/http.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/impls/src/node_clients/http.rs b/impls/src/node_clients/http.rs index e96d4c1d..585c6438 100644 --- a/impls/src/node_clients/http.rs +++ b/impls/src/node_clients/http.rs @@ -321,7 +321,8 @@ impl NodeClient for HTTPNodeClient { let params = json!([start_index, end_index, max_outputs, Some(true)]); let res = self.send_json_request::("get_unspent_outputs", ¶ms)?; - for out in res.outputs { + // We asked for unspent outputs via the api but defensively filter out spent outputs just in case. + for out in res.outputs.into_iter().filter(|out| out.spent == false) { let is_coinbase = match out.output_type { api::OutputType::Coinbase => true, api::OutputType::Transaction => false,