Skip to content

Commit

Permalink
fixup! Associate position with temporary contract id
Browse files Browse the repository at this point in the history
  • Loading branch information
da-kami committed Jul 20, 2023
1 parent 385eb5b commit 63b73cc
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions crates/ln-dlc-node/src/node/dlc_channel.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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())
}
Expand Down

0 comments on commit 63b73cc

Please sign in to comment.