Skip to content

Commit 8f1ea56

Browse files
committed
Export several additional macros from functional_test_utils
...and clean up their use of references to imported/local structs.
1 parent 3ec529d commit 8f1ea56

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

lightning/src/ln/functional_test_utils.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,11 @@ pub fn create_chan_between_nodes_with_value<'a, 'b, 'c, 'd>(node_a: &'a Node<'b,
336336
}
337337

338338
#[macro_export]
339+
/// Gets an RAA and CS which were sent in response to a commitment update
339340
macro_rules! get_revoke_commit_msgs {
340341
($node: expr, $node_id: expr) => {
341342
{
342-
use util::events::MessageSendEvent;
343+
use $crate::util::events::MessageSendEvent;
343344
let events = $node.node.get_and_clear_pending_msg_events();
344345
assert_eq!(events.len(), 2);
345346
(match events[0] {
@@ -400,8 +401,8 @@ macro_rules! get_event {
400401
}
401402
}
402403

403-
#[cfg(test)]
404404
#[macro_export]
405+
/// Gets an UpdateHTLCs MessageSendEvent
405406
macro_rules! get_htlc_update_msgs {
406407
($node: expr, $node_id: expr) => {
407408
{
@@ -933,6 +934,9 @@ impl SendEvent {
933934
}
934935
}
935936

937+
#[macro_export]
938+
/// Performs the "commitment signed dance" - the series of message exchanges which occur after a
939+
/// commitment update.
936940
macro_rules! commitment_signed_dance {
937941
($node_a: expr, $node_b: expr, $commitment_signed: expr, $fail_backwards: expr, true /* skip last step */) => {
938942
{
@@ -999,7 +1003,7 @@ macro_rules! commitment_signed_dance {
9991003
{
10001004
commitment_signed_dance!($node_a, $node_b, $commitment_signed, $fail_backwards, true);
10011005
if $fail_backwards {
1002-
expect_pending_htlcs_forwardable!($node_a);
1006+
$crate::expect_pending_htlcs_forwardable!($node_a);
10031007
check_added_monitors!($node_a, 1);
10041008

10051009
let channel_state = $node_a.node.channel_state.lock().unwrap();
@@ -1057,6 +1061,8 @@ macro_rules! get_route_and_payment_hash {
10571061
}}
10581062
}
10591063

1064+
#[macro_export]
1065+
/// Clears (and ignores) a PendingHTLCsForwardable event
10601066
macro_rules! expect_pending_htlcs_forwardable_ignore {
10611067
($node: expr) => {{
10621068
let events = $node.node.get_and_clear_pending_events();
@@ -1068,9 +1074,11 @@ macro_rules! expect_pending_htlcs_forwardable_ignore {
10681074
}}
10691075
}
10701076

1077+
#[macro_export]
1078+
/// Handles a PendingHTLCsForwardable event
10711079
macro_rules! expect_pending_htlcs_forwardable {
10721080
($node: expr) => {{
1073-
expect_pending_htlcs_forwardable_ignore!($node);
1081+
$crate::expect_pending_htlcs_forwardable_ignore!($node);
10741082
$node.node.process_pending_htlc_forwards();
10751083

10761084
// Ensure process_pending_htlc_forwards is idempotent.

0 commit comments

Comments
 (0)