Skip to content

Commit 1be3caf

Browse files
committed
f add docs
1 parent 4054bc4 commit 1be3caf

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lightning/src/ln/functional_test_utils.rs

+14
Original file line numberDiff line numberDiff line change
@@ -1563,13 +1563,22 @@ macro_rules! commitment_signed_dance {
15631563
}
15641564
}
15651565

1566+
/// Runs the commitment_signed dance after the initial commitment_signed is delivered through to
1567+
/// the initiator's `revoke_and_ack` resposne. i.e. [`do_main_commitment_signed_dance`] plus the
1568+
/// `revoke_and_ack` response to it.
1569+
///
1570+
/// Returns any additional message `node_b` generated in addition to the `revoke_and_ack` response.
15661571
pub fn commitment_signed_dance_through_cp_raa(node_a: &Node<'_, '_, '_>, node_b: &Node<'_, '_, '_>, fail_backwards: bool) -> Option<MessageSendEvent> {
15671572
let (extra_msg_option, bs_revoke_and_ack) = do_main_commitment_signed_dance(node_a, node_b, fail_backwards);
15681573
node_a.node.handle_revoke_and_ack(&node_b.node.get_our_node_id(), &bs_revoke_and_ack);
15691574
check_added_monitors(node_a, 1);
15701575
extra_msg_option
15711576
}
15721577

1578+
/// Does the main logic in the commitment_signed dance. After the first `commitment_signed` has
1579+
/// been delivered, this method picks up and delivers the response `revoke_and_ack` and
1580+
/// `commitment_signed`, returning the receipient's `revoke_and_ack` and any extra message it may
1581+
/// have included.
15731582
pub fn do_main_commitment_signed_dance(node_a: &Node<'_, '_, '_>, node_b: &Node<'_, '_, '_>, fail_backwards: bool) -> (Option<MessageSendEvent>, msgs::RevokeAndACK) {
15741583
let (as_revoke_and_ack, as_commitment_signed) = get_revoke_commit_msgs!(node_a, node_b.node.get_our_node_id());
15751584
check_added_monitors!(node_b, 0);
@@ -1598,6 +1607,11 @@ pub fn do_main_commitment_signed_dance(node_a: &Node<'_, '_, '_>, node_b: &Node<
15981607
(extra_msg_option, bs_revoke_and_ack)
15991608
}
16001609

1610+
/// Runs a full commitment_signed dance, delivering a commitment_signed, the responding
1611+
/// `revoke_and_ack` and `commitment_signed`, and then the final `revoke_and_ack` response.
1612+
///
1613+
/// If `skip_last_step` is unset, also checks for the payment failure update for the previous hop
1614+
/// on failure or that no new messages are left over on success.
16011615
pub fn do_commitment_signed_dance(node_a: &Node<'_, '_, '_>, node_b: &Node<'_, '_, '_>, commitment_signed: &msgs::CommitmentSigned, fail_backwards: bool, skip_last_step: bool) {
16021616
check_added_monitors!(node_a, 0);
16031617
assert!(node_a.node.get_and_clear_pending_msg_events().is_empty());

0 commit comments

Comments
 (0)