From dc46a9d6495a404173cd8b6de0981e25876485db Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Tue, 3 Dec 2024 15:27:59 +0100 Subject: [PATCH] core: fixing the esplora error match Recent version of esplora (from v0.10) changed the error type, so this commit is reflecting the change. Link: https://github.com/lightningdevkit/ldk-node/issues/412 Signed-off-by: Vincenzo Palazzo --- src/chain/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/chain/mod.rs b/src/chain/mod.rs index 4343d8ad5..6c89476d2 100644 --- a/src/chain/mod.rs +++ b/src/chain/mod.rs @@ -991,8 +991,8 @@ impl ChainSource { ); }, Err(e) => match e { - esplora_client::Error::Reqwest(err) => { - if err.status() == reqwest::StatusCode::from_u16(400).ok() { + esplora_client::Error::HttpResponse { status, message } => { + if status == 400 { // Log 400 at lesser level, as this often just means bitcoind already knows the // transaction. // FIXME: We can further differentiate here based on the error @@ -1001,13 +1001,13 @@ impl ChainSource { log_trace!( logger, "Failed to broadcast due to HTTP connection error: {}", - err + message ); } else { log_error!( logger, - "Failed to broadcast due to HTTP connection error: {}", - err + "Failed to broadcast due to HTTP connection error: {} - {}", + status, message ); } log_trace!(