Skip to content

Commit

Permalink
Merge pull request #1804 from get10101/chore/max-dlc-channels-1
Browse files Browse the repository at this point in the history
chore: don't allow more than one dlc-channel per user
  • Loading branch information
bonomat authored Jan 8, 2024
2 parents 74c2e21 + 7288c7a commit 77282fa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Chore: move telegram link into toplevel of settings so that it can be found easier
- Feat: update coordinator API to show more details on pending channel balance
- Feat: show dlc-channel balance instead of ln-balance in app and in coordinator's API
- Chore: don't allow multiple dlc-channels per user

## [1.7.4] - 2023-12-20

Expand Down
13 changes: 13 additions & 0 deletions crates/ln-dlc-node/src/node/dlc_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ impl<S: TenTenOneStorage + 'static, N: LnDlcStorage + Sync + Send + 'static> Nod
"Sending DLC channel offer"
);

if let Some(channel) = self
.list_dlc_channels()?
.iter()
.find(|channel| channel.counter_party == counterparty)
{
tracing::error!(
trader_id = %counterparty,
existing_channel_id = channel.channel_id.to_hex(),
existing_channel_state = %channel.state,
"We can't open a new channel because we still have an open dlc-channel");
bail!("Cant have more than one dlc channel.");
}

spawn_blocking({
let p2pd_oracles = self.oracles.clone();

Expand Down

0 comments on commit 77282fa

Please sign in to comment.