diff --git a/dlc-manager/src/sub_channel_manager.rs b/dlc-manager/src/sub_channel_manager.rs index 6a0292a4..79173b19 100644 --- a/dlc-manager/src/sub_channel_manager.rs +++ b/dlc-manager/src/sub_channel_manager.rs @@ -340,7 +340,7 @@ where .get_sub_channel(channel_details.channel_id)? { Some(mut s) => match s.state { - SubChannelState::OffChainClosed => { + SubChannelState::OffChainClosed | SubChannelState::Rejected => { s.is_offer = true; s.update_idx -= 1; @@ -1585,7 +1585,7 @@ where .get_sub_channel(channel_details.channel_id)? { Some(mut s) => match s.state { - SubChannelState::OffChainClosed => { + SubChannelState::OffChainClosed | SubChannelState::Rejected => { s.is_offer = false; s.update_idx -= 1; Some(s) diff --git a/dlc-manager/tests/ln_dlc_channel_execution_tests.rs b/dlc-manager/tests/ln_dlc_channel_execution_tests.rs index d9ba0b4c..1cbf0614 100644 --- a/dlc-manager/tests/ln_dlc_channel_execution_tests.rs +++ b/dlc-manager/tests/ln_dlc_channel_execution_tests.rs @@ -951,6 +951,29 @@ fn ln_dlc_rejected_offer() { reject_offer(&test_params); } + +#[test] +#[ignore] +fn ln_dlc_rejected_offer_then_new_offer_and_accept_offer() { + let test_params = test_init(); + make_ln_payment(&test_params.alice_node, &test_params.bob_node, 900000); + + reject_offer(&test_params); + + offer_sub_channel_internal(&test_params, false); + + assert_sub_channel_state!( + test_params.alice_node.sub_channel_manager, + &test_params.channel_id, + Signed + ); + assert_sub_channel_state!( + test_params.bob_node.sub_channel_manager, + &test_params.channel_id, + Signed + ); +} + #[test] #[ignore] fn ln_dlc_rejected_close() {