Skip to content

Commit

Permalink
Merge #319
Browse files Browse the repository at this point in the history
319: fix: Compute payout is greater than total collateral r=luckysori a=holzeis

Resolves #289. 
Resolves #306.

The `rust-dlc` [branch](p2pderivatives/rust-dlc#97) that we depend on has already been rebased onto `master`, so we can fix the bug like this.


Co-authored-by: Lucas Soriano del Pino <lucas_soriano@fastmail.com>
  • Loading branch information
bors[bot] and luckysori authored Mar 23, 2023
2 parents 18fb576 + 106f5cd commit d3459f0
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 21 deletions.
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ members = ["coordinator", "maker", "mobile/native/", "crates/*"]
resolver = "2"

[patch.crates-io]
dlc-manager = { git = "https://github.com/get10101/rust-dlc", rev = "ef3fe72c5e0f8930010fb13b6ea5dc3d91457c0f" }
dlc-messages = { git = "https://github.com/get10101/rust-dlc", rev = "ef3fe72c5e0f8930010fb13b6ea5dc3d91457c0f" }
dlc = { git = "https://github.com/get10101/rust-dlc", rev = "ef3fe72c5e0f8930010fb13b6ea5dc3d91457c0f" }
dlc-sled-storage-provider = { git = "https://github.com/get10101/rust-dlc", rev = "ef3fe72c5e0f8930010fb13b6ea5dc3d91457c0f" }
p2pd-oracle-client = { git = "https://github.com/get10101/rust-dlc", rev = "ef3fe72c5e0f8930010fb13b6ea5dc3d91457c0f" }
dlc-trie = { git = "https://github.com/get10101/rust-dlc", rev = "ef3fe72c5e0f8930010fb13b6ea5dc3d91457c0f" }
simple-wallet = { git = "https://github.com/get10101/rust-dlc", rev = "ef3fe72c5e0f8930010fb13b6ea5dc3d91457c0f" }
dlc-manager = { git = "https://github.com/p2pderivatives/rust-dlc", rev = "182442b318f5430b74fde407ed79ccad0d596597" }
dlc-messages = { git = "https://github.com/p2pderivatives/rust-dlc", rev = "182442b318f5430b74fde407ed79ccad0d596597" }
dlc = { git = "https://github.com/p2pderivatives/rust-dlc", rev = "182442b318f5430b74fde407ed79ccad0d596597" }
dlc-sled-storage-provider = { git = "https://github.com/p2pderivatives/rust-dlc", rev = "182442b318f5430b74fde407ed79ccad0d596597" }
p2pd-oracle-client = { git = "https://github.com/p2pderivatives/rust-dlc", rev = "182442b318f5430b74fde407ed79ccad0d596597" }
dlc-trie = { git = "https://github.com/p2pderivatives/rust-dlc", rev = "182442b318f5430b74fde407ed79ccad0d596597" }
simple-wallet = { git = "https://github.com/p2pderivatives/rust-dlc", rev = "182442b318f5430b74fde407ed79ccad0d596597" }
lightning = { git = "https://github.com/p2pderivatives/rust-lightning/", rev = "dff302382d04700f23d79fb3275c1798d775fef6" }
lightning-background-processor = { git = "https://github.com/p2pderivatives/rust-lightning/", rev = "dff302382d04700f23d79fb3275c1798d775fef6" }
lightning-block-sync = { git = "https://github.com/p2pderivatives/rust-lightning/", rev = "dff302382d04700f23d79fb3275c1798d775fef6" }
Expand Down
2 changes: 2 additions & 0 deletions crates/ln-dlc-node/src/ln/dlc_channel_details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pub enum SubChannelState {
CloseConfirmed,
OffChainClosed,
ClosedPunished,
Rejected,
}

impl From<SubChannel> for DlcChannelDetails {
Expand Down Expand Up @@ -63,6 +64,7 @@ impl From<dlc_manager::subchannel::SubChannelState> for SubChannelState {
CloseConfirmed(_) => SubChannelState::CloseConfirmed,
OffChainClosed => SubChannelState::OffChainClosed,
ClosedPunished(_) => SubChannelState::ClosedPunished,
Rejected => SubChannelState::Rejected,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/ln-dlc-node/src/node/dlc_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,6 @@ pub fn sub_channel_message_as_str(msg: &SubChannelMessage) -> &str {
CloseAccept(_) => "CloseAccept",
CloseConfirm(_) => "CloseConfirm",
CloseFinalize(_) => "CloseFinalize",
CloseReject(_) => "CloseReject",
Reject(_) => "Reject",
}
}
6 changes: 2 additions & 4 deletions crates/ln-dlc-node/src/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,8 @@ impl Node {
)?;
let dlc_manager = Arc::new(dlc_manager);

let sub_channel_manager = {
let (height, _) = ln_dlc_wallet.tip()?;
sub_channel_manager::build(channel_manager.clone(), dlc_manager.clone(), height as u64)?
};
let sub_channel_manager =
sub_channel_manager::build(channel_manager.clone(), dlc_manager.clone())?;

// Connection manager
tokio::spawn({
Expand Down
2 changes: 0 additions & 2 deletions crates/ln-dlc-node/src/node/sub_channel_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ pub type SubChannelManager = sub_channel_manager::SubChannelManager<
pub(crate) fn build(
channel_manager: Arc<ChannelManager>,
dlc_manager: Arc<DlcManager>,
height: u64,
) -> Result<Arc<SubChannelManager>> {
Ok(Arc::new(SubChannelManager::new(
channel_manager.clone(),
dlc_manager,
height,
)))
}

0 comments on commit d3459f0

Please sign in to comment.