From 63b73cc0541dd07de3bff120d9306b605e2884df Mon Sep 17 00:00:00 2001 From: Daniel Karzel Date: Thu, 20 Jul 2023 21:36:17 +1000 Subject: [PATCH] fixup! Associate position with temporary contract id --- crates/ln-dlc-node/src/node/dlc_channel.rs | 23 +++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/crates/ln-dlc-node/src/node/dlc_channel.rs b/crates/ln-dlc-node/src/node/dlc_channel.rs index e92f44df7..571f797a2 100644 --- a/crates/ln-dlc-node/src/node/dlc_channel.rs +++ b/crates/ln-dlc-node/src/node/dlc_channel.rs @@ -1,6 +1,7 @@ use crate::node::Node; use crate::DlcMessageHandler; use crate::SubChannelManager; +use crate::ToHex; use anyhow::anyhow; use anyhow::bail; use anyhow::Context; @@ -149,23 +150,35 @@ where .dlc_manager .get_store() .get_sub_channel(sub_channel_id)? - .context("not found")? + .with_context(|| format!("No subchannel found for id {}", sub_channel_id.to_hex()))? .get_dlc_channel_id(0) - .context("not found")?; + .context("No dlc channel with index 0 found")?; let contract_id = self .dlc_manager .get_store() .get_channel(&dlc_channel_id)? - .context("not found")? + .with_context(|| { + format!( + "No dlc channel found for dlc channel id {}", + dlc_channel_id.to_hex() + ) + })? .get_contract_id() - .context("Should be set in offered")?; + .with_context(|| { + format!( + "No contract id set for dlc channel with id {}", + dlc_channel_id.to_hex() + ) + })?; let contract = self .dlc_manager .get_store() .get_contract(&contract_id)? - .context("expect to exist")?; + .with_context(|| { + format!("No contract found for contract id {}", contract_id.to_hex()) + })?; Ok(contract.get_temporary_id()) }