Skip to content

Commit

Permalink
Fix settle after disconnect during open bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Tibo-lg committed Aug 28, 2023
1 parent a765a59 commit 1799e44
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dlc-manager/src/sub_channel_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3188,7 +3188,7 @@ where
temporary_channel_id: dlc_channel.temporary_channel_id,
party_points: dlc_channel.own_points,
per_update_point: dlc_channel.own_per_update_point,
offer_per_update_seed: channel.per_split_seed,
offer_per_update_seed: Some(dlc_channel.own_per_update_seed),
is_offer_party: true,
counter_party: dlc_channel.counter_party,
// TODO(tibo): use value from original offer
Expand Down
32 changes: 32 additions & 0 deletions dlc-manager/tests/ln_dlc_channel_execution_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,38 @@ fn ln_dlc_renewed_close() {
force_close_stable(&mut test_params);
}

#[test]
#[ignore]
fn ln_dlc_open_disconnect_settled_close() {
let mut test_params = test_init();

make_ln_payment(&test_params.alice_node, &test_params.bob_node, 900000);

offer_sub_channel_with_reconnect(&test_params);
let sub_channel = test_params
.alice_node
.dlc_manager
.get_store()
.get_sub_channel(test_params.channel_id)
.unwrap()
.unwrap();
let dlc_channel_id = sub_channel.get_dlc_channel_id(0).unwrap();
let contract_id = assert_channel_contract_state!(
test_params.alice_node.dlc_manager,
dlc_channel_id,
Confirmed
);

settle(&test_params, &dlc_channel_id);

assert_contract_state_unlocked!(test_params.alice_node.dlc_manager, contract_id, Closed);
assert_contract_state_unlocked!(test_params.bob_node.dlc_manager, contract_id, Closed);

mocks::mock_time::set_time(EVENT_MATURITY as u64);

force_close_stable(&mut test_params);
}

#[test]
#[ignore]
fn ln_dlc_settled_close() {
Expand Down

0 comments on commit 1799e44

Please sign in to comment.