From 2cd242a912f1be1b877687304e1797af2b425f70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zoe=20Faltib=C3=A0?= Date: Mon, 24 Jun 2024 17:56:50 +0200 Subject: [PATCH] fix electrum resolve_height for offchain TXs --- src/resolvers/electrum_blocking.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/resolvers/electrum_blocking.rs b/src/resolvers/electrum_blocking.rs index 4918f76..aca0d0b 100644 --- a/src/resolvers/electrum_blocking.rs +++ b/src/resolvers/electrum_blocking.rs @@ -78,10 +78,19 @@ impl RgbResolver for Client { // Now we get and parse transaction information to get the number of // confirmations - let tx_details = check!(self.raw_call("blockchain.transaction.get", vec![ + let tx_details = match self.raw_call("blockchain.transaction.get", vec![ Param::String(txid.to_string()), Param::Bool(true), - ])); + ]) { + Err(e) + if e.to_string() + .contains("No such mempool or blockchain transaction") => + { + return Ok(witness_anchor); + } + Err(e) => return Err(e.to_string()), + Ok(v) => v, + }; let forward = iter::from_fn(|| self.block_headers_pop().ok().flatten()).count() as isize; let Some(confirmations) = tx_details.get("confirmations") else {