Remove `get_htlc_update_msgs` macro
What changed, and why it matters
This commit is a straightforward internal cleanup in the rust-lightning test code. It removes a helper macro called `get_htlc_update_msgs!` and replaces every use of it with an already-existing function of the same name. There is no change to production code, user-facing behavior, or security logic.
No security action needed. This is a refactoring/cleanup change. Normal code-review approval is sufficient.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch deletes the get_htlc_update_msgs! macro from lightning/src/ln/functional_test_utils.rs and mechanically converts all call sites from macro syntax (get_htlc_update_msgs!(node, node_id)) to function syntax (get_htlc_update_msgs(&node, &node_id)). The function body is unchanged. All modified files are test modules; no library logic, protocol handling, or cryptographic code is altered.
Changed components
lightning/src/ln/functional_test_utils.rstest modules across lightning and lightning-dns-resolverInspect captured patch +238 / −249
diff --git a/lightning-dns-resolver/src/lib.rs b/lightning-dns-resolver/src/lib.rs
index 8d47098..471c756 100644
--- a/lightning-dns-resolver/src/lib.rs
+++ b/lightning-dns-resolver/src/lib.rs
@@ -180,7 +180,7 @@ mod test {
use lightning::types::payment::PaymentHash;
use lightning::util::logger::Logger;
- use lightning::{expect_payment_claimed, get_htlc_update_msgs};
+ use lightning::expect_payment_claimed;
use lightning_types::string::UntrustedString;
use std::ops::Deref;
@@ -416,7 +416,7 @@ mod test {
nodes[0].onion_messenger.handle_onion_message(payee_id, &inv);
check_added_monitors(&nodes[0], 1);
- let updates = get_htlc_update_msgs!(nodes[0], payee_id);
+ let updates = get_htlc_update_msgs(&nodes[0], &payee_id);
nodes[1].node.handle_update_add_htlc(payer_id, &updates.update_add_htlcs[0]);
do_commitment_signed_dance(&nodes[1], &nodes[0], &updates.commitment_signed, false, false);
expect_and_process_pending_htlcs(&nodes[1], false);
@@ -450,7 +450,7 @@ mod test {
}
check_added_monitors(&nodes[1], 1);
- let mut updates = get_htlc_update_msgs!(nodes[1], payer_id);
+ let mut updates = get_htlc_update_msgs(&nodes[1], &payer_id);
nodes[0].node.handle_update_fulfill_htlc(payee_id, updates.update_fulfill_htlcs.remove(0));
do_commitment_signed_dance(&nodes[0], &nodes[1], &updates.commitment_signed, false, false);
diff --git a/lightning/src/chain/chainmonitor.rs b/lightning/src/chain/chainmonitor.rs
index 046e285..846e717 100644
--- a/lightning/src/chain/chainmonitor.rs
+++ b/lightning/src/chain/chainmonitor.rs
@@ -1597,7 +1597,6 @@ mod tests {
use crate::chain::channelmonitor::ANTI_REORG_DELAY;
use crate::chain::{ChannelMonitorUpdateStatus, Watch};
use crate::events::{ClosureReason, Event};
- use crate::get_htlc_update_msgs;
use crate::ln::functional_test_utils::*;
use crate::ln::msgs::{BaseMessageHandler, ChannelMessageHandler, MessageSendEvent};
use crate::{check_added_monitors, check_closed_event};
@@ -1691,7 +1690,7 @@ mod tests {
// Now manually walk the commitment signed dance - because we claimed two payments
// back-to-back it doesn't fit into the neat walk commitment_signed_dance does.
- let mut updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fulfill_htlc(node_b_id, updates.update_fulfill_htlcs.remove(0));
expect_payment_sent(&nodes[0], payment_preimage_1, None, false, false);
nodes[0].node.handle_commitment_signed_batch_test(node_b_id, &updates.commitment_signed);
@@ -1700,7 +1699,7 @@ mod tests {
nodes[1].node.handle_revoke_and_ack(node_a_id, &as_first_raa);
check_added_monitors!(nodes[1], 1);
- let mut bs_2nd_updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut bs_2nd_updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[1].node.handle_commitment_signed_batch_test(node_a_id, &as_first_update);
check_added_monitors!(nodes[1], 1);
let bs_first_raa = get_event_msg!(nodes[1], MessageSendEvent::SendRevokeAndACK, node_a_id);
diff --git a/lightning/src/ln/async_payments_tests.rs b/lightning/src/ln/async_payments_tests.rs
index 2de00d0..3c96de3 100644
--- a/lightning/src/ln/async_payments_tests.rs
+++ b/lightning/src/ln/async_payments_tests.rs
@@ -582,7 +582,7 @@ fn lock_in_htlc_for_static_invoice(
// The sender should lock in the held HTLC with their LSP right after receiving the static invoice.
sender.onion_messenger.handle_onion_message(om_peer, &static_invoice_om);
check_added_monitors(sender, 1);
- let commitment_update = get_htlc_update_msgs!(sender, sender_lsp.node.get_our_node_id());
+ let commitment_update = get_htlc_update_msgs(&sender, &sender_lsp.node.get_our_node_id());
let update_add = commitment_update.update_add_htlcs[0].clone();
let payment_hash = update_add.payment_hash;
assert!(update_add.hold_htlc.is_some());
@@ -639,7 +639,7 @@ fn invalid_keysend_payment_secret() {
.expect_failure(HTLCHandlingFailureType::Receive { payment_hash });
do_pass_along_path(args);
- let updates_2_1 = get_htlc_update_msgs!(nodes[2], nodes[1].node.get_our_node_id());
+ let updates_2_1 = get_htlc_update_msgs(&nodes[2], &nodes[1].node.get_our_node_id());
assert_eq!(updates_2_1.update_fail_malformed_htlcs.len(), 1);
let update_malformed = &updates_2_1.update_fail_malformed_htlcs[0];
assert_eq!(update_malformed.sha256_of_onion, [0; 32]);
@@ -652,7 +652,7 @@ fn invalid_keysend_payment_secret() {
.handle_update_fail_malformed_htlc(nodes[2].node.get_our_node_id(), update_malformed);
do_commitment_signed_dance(&nodes[1], &nodes[2], &updates_2_1.commitment_signed, true, false);
- let updates_1_0 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let updates_1_0 = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
assert_eq!(updates_1_0.update_fail_htlcs.len(), 1);
nodes[0].node.handle_update_fail_htlc(
nodes[1].node.get_our_node_id(),
diff --git a/lightning/src/ln/async_signer_tests.rs b/lightning/src/ln/async_signer_tests.rs
index 03728e2..7fb67cc 100644
--- a/lightning/src/ln/async_signer_tests.rs
+++ b/lightning/src/ln/async_signer_tests.rs
@@ -950,7 +950,7 @@ fn do_test_async_commitment_signature_ordering(monitor_update_failure: bool) {
// The rest of this is boilerplate for resolving the previous state.
nodes[0].node.handle_revoke_and_ack(node_b_id, &bs_revoke_and_ack);
- let as_commitment_signed = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let as_commitment_signed = get_htlc_update_msgs(&nodes[0], &node_b_id);
check_added_monitors!(nodes[0], 1);
nodes[0].node.handle_commitment_signed_batch_test(node_b_id, &bs_second_commitment_signed);
@@ -1358,12 +1358,12 @@ fn test_no_disconnect_while_async_revoke_and_ack_expecting_remote_commitment_sig
nodes[1].node.send_payment_with_route(route2, payment_hash2, onion2, payment_id2).unwrap();
check_added_monitors(&nodes[1], 1);
- let update = get_htlc_update_msgs!(&nodes[0], node_b_id);
+ let update = get_htlc_update_msgs(&nodes[0], &node_b_id);
nodes[1].node.handle_update_add_htlc(node_a_id, &update.update_add_htlcs[0]);
nodes[1].node.handle_commitment_signed_batch_test(node_a_id, &update.commitment_signed);
check_added_monitors(&nodes[1], 1);
- let update = get_htlc_update_msgs!(&nodes[1], node_a_id);
+ let update = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_add_htlc(node_b_id, &update.update_add_htlcs[0]);
nodes[0].node.handle_commitment_signed_batch_test(node_b_id, &update.commitment_signed);
check_added_monitors(&nodes[0], 1);
@@ -1420,7 +1420,7 @@ fn test_no_disconnect_while_async_commitment_signed_expecting_remote_revoke_and_
// After processing the `update_fulfill`, they'll only be able to send `revoke_and_ack` until
// the `commitment_signed` is no longer pending.
- let mut update = get_htlc_update_msgs!(&nodes[1], node_a_id);
+ let mut update = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fulfill_htlc(node_b_id, update.update_fulfill_htlcs.remove(0));
expect_payment_sent(&nodes[0], preimage, None, false, false);
nodes[0].node.handle_commitment_signed_batch_test(node_b_id, &update.commitment_signed);
diff --git a/lightning/src/ln/blinded_payment_tests.rs b/lightning/src/ln/blinded_payment_tests.rs
index cfb2878..51e0e7f 100644
--- a/lightning/src/ln/blinded_payment_tests.rs
+++ b/lightning/src/ln/blinded_payment_tests.rs
@@ -126,7 +126,7 @@ pub fn fail_blinded_htlc_backwards(
expect_payment_failed_conditions(&nodes[0], payment_hash, false, payment_failed_conditions);
},
i if i <= intro_node_idx => {
- let unblinded_node_updates = get_htlc_update_msgs!(nodes[i], nodes[i-1].node.get_our_node_id());
+ let unblinded_node_updates = get_htlc_update_msgs(&nodes[i], &nodes[i-1].node.get_our_node_id());
assert_eq!(unblinded_node_updates.update_fail_htlcs.len(), 1);
nodes[i-1].node.handle_update_fail_htlc(
nodes[i].node.get_our_node_id(), &unblinded_node_updates.update_fail_htlcs[i-1]
@@ -134,7 +134,7 @@ pub fn fail_blinded_htlc_backwards(
do_commitment_signed_dance(&nodes[i-1], &nodes[i], &unblinded_node_updates.commitment_signed, false, false);
},
_ => {
- let blinded_node_updates = get_htlc_update_msgs!(nodes[i], nodes[i-1].node.get_our_node_id());
+ let blinded_node_updates = get_htlc_update_msgs(&nodes[i], &nodes[i-1].node.get_our_node_id());
assert_eq!(blinded_node_updates.update_fail_malformed_htlcs.len(), 1);
let update_malformed = &blinded_node_updates.update_fail_malformed_htlcs[0];
assert_eq!(update_malformed.sha256_of_onion, [0; 32]);
@@ -426,7 +426,7 @@ fn do_forward_checks_failure(check: ForwardCheckFail, intro_fails: bool) {
}
}
- let mut updates_0_1 = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
+ let mut updates_0_1 = get_htlc_update_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
let update_add = &mut updates_0_1.update_add_htlcs[0];
if intro_fails {
@@ -441,7 +441,7 @@ fn do_forward_checks_failure(check: ForwardCheckFail, intro_fails: bool) {
check_added_monitors!(nodes[1], 1);
if intro_fails {
- let mut updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let mut updates = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
nodes[0].node.handle_update_fail_htlc(nodes[1].node.get_our_node_id(), &updates.update_fail_htlcs[0]);
do_commitment_signed_dance(&nodes[0], &nodes[1], &updates.commitment_signed, false, false);
let failed_destination = match check {
@@ -466,7 +466,7 @@ fn do_forward_checks_failure(check: ForwardCheckFail, intro_fails: bool) {
return
}
- let mut updates_1_2 = get_htlc_update_msgs!(nodes[1], nodes[2].node.get_our_node_id());
+ let mut updates_1_2 = get_htlc_update_msgs(&nodes[1], &nodes[2].node.get_our_node_id());
let mut update_add = &mut updates_1_2.update_add_htlcs[0];
cause_error!(2, 3, update_add);
@@ -486,7 +486,7 @@ fn do_forward_checks_failure(check: ForwardCheckFail, intro_fails: bool) {
);
check_added_monitors!(nodes[2], 1);
- let mut updates = get_htlc_update_msgs!(nodes[2], nodes[1].node.get_our_node_id());
+ let mut updates = get_htlc_update_msgs(&nodes[2], &nodes[1].node.get_our_node_id());
let update_malformed = &mut updates.update_fail_malformed_htlcs[0];
assert_eq!(update_malformed.failure_code, LocalHTLCFailureReason::InvalidOnionBlinding.failure_code());
assert_eq!(update_malformed.sha256_of_onion, [0; 32]);
@@ -497,7 +497,7 @@ fn do_forward_checks_failure(check: ForwardCheckFail, intro_fails: bool) {
nodes[1].node.handle_update_fail_malformed_htlc(nodes[2].node.get_our_node_id(), update_malformed);
do_commitment_signed_dance(&nodes[1], &nodes[2], &updates.commitment_signed, true, false);
- let mut updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let mut updates = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
nodes[0].node.handle_update_fail_htlc(nodes[1].node.get_our_node_id(), &updates.update_fail_htlcs[0]);
do_commitment_signed_dance(&nodes[0], &nodes[1], &updates.commitment_signed, false, false);
expect_payment_failed_conditions(&nodes[0], payment_hash, false,
@@ -550,7 +550,7 @@ fn failed_backwards_to_intro_node() {
expect_htlc_handling_failed_destinations!(nodes[2].node.get_and_clear_pending_events(), &[HTLCHandlingFailureType::InvalidOnion]);
check_added_monitors(&nodes[2], 1);
- let mut updates = get_htlc_update_msgs!(nodes[2], nodes[1].node.get_our_node_id());
+ let mut updates = get_htlc_update_msgs(&nodes[2], &nodes[1].node.get_our_node_id());
let mut update_malformed = &mut updates.update_fail_malformed_htlcs[0];
// Check that the final node encodes its failure correctly.
assert_eq!(update_malformed.failure_code, LocalHTLCFailureReason::InvalidOnionBlinding.failure_code());
@@ -562,7 +562,7 @@ fn failed_backwards_to_intro_node() {
nodes[1].node.handle_update_fail_malformed_htlc(nodes[2].node.get_our_node_id(), update_malformed);
do_commitment_signed_dance(&nodes[1], &nodes[2], &updates.commitment_signed, true, false);
- let mut updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let mut updates = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
nodes[0].node.handle_update_fail_htlc(nodes[1].node.get_our_node_id(), &updates.update_fail_htlcs[0]);
do_commitment_signed_dance(&nodes[0], &nodes[1], &updates.commitment_signed, false, false);
expect_payment_failed_conditions(&nodes[0], payment_hash, false,
@@ -658,7 +658,7 @@ fn do_forward_fail_in_process_pending_htlc_fwds(check: ProcessPendingHTLCsCheck,
expect_and_process_pending_htlcs(&nodes[1], false);
check_added_monitors!(nodes[1], 1);
- let mut updates_1_2 = get_htlc_update_msgs!(nodes[1], nodes[2].node.get_our_node_id());
+ let mut updates_1_2 = get_htlc_update_msgs(&nodes[1], &nodes[2].node.get_our_node_id());
let mut update_add = &mut updates_1_2.update_add_htlcs[0];
nodes[2].node.handle_update_add_htlc(nodes[1].node.get_our_node_id(), &update_add);
check_added_monitors!(nodes[2], 0);
@@ -667,7 +667,7 @@ fn do_forward_fail_in_process_pending_htlc_fwds(check: ProcessPendingHTLCsCheck,
cause_error!(nodes[1], nodes[2], nodes[3], chan_id_2_3, chan_upd_2_3.short_channel_id);
check_added_monitors!(nodes[2], 1);
- let mut updates = get_htlc_update_msgs!(nodes[2], nodes[1].node.get_our_node_id());
+ let mut updates = get_htlc_update_msgs(&nodes[2], &nodes[1].node.get_our_node_id());
let update_malformed = &mut updates.update_fail_malformed_htlcs[0];
assert_eq!(update_malformed.failure_code, LocalHTLCFailureReason::InvalidOnionBlinding.failure_code());
assert_eq!(update_malformed.sha256_of_onion, [0; 32]);
@@ -678,7 +678,7 @@ fn do_forward_fail_in_process_pending_htlc_fwds(check: ProcessPendingHTLCsCheck,
nodes[1].node.handle_update_fail_malformed_htlc(nodes[2].node.get_our_node_id(), update_malformed);
do_commitment_signed_dance(&nodes[1], &nodes[2], &updates.commitment_signed, true, false);
- let mut updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let mut updates = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
nodes[0].node.handle_update_fail_htlc(nodes[1].node.get_our_node_id(), &updates.update_fail_htlcs[0]);
do_commitment_signed_dance(&nodes[0], &nodes[1], &updates.commitment_signed, false, false);
expect_payment_failed_conditions(&nodes[0], payment_hash, false,
@@ -1051,7 +1051,7 @@ fn do_multi_hop_receiver_fail(check: ReceiveCheckFail) {
}
}
- let updates_2_1 = get_htlc_update_msgs!(nodes[2], nodes[1].node.get_our_node_id());
+ let updates_2_1 = get_htlc_update_msgs(&nodes[2], &nodes[1].node.get_our_node_id());
assert_eq!(updates_2_1.update_fail_malformed_htlcs.len(), 1);
let update_malformed = &updates_2_1.update_fail_malformed_htlcs[0];
assert_eq!(update_malformed.sha256_of_onion, [0; 32]);
@@ -1072,7 +1072,7 @@ fn do_multi_hop_receiver_fail(check: ReceiveCheckFail) {
_ => panic!()
}
}).unwrap()
- } else { get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id()) };
+ } else { get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id()) };
assert_eq!(updates_1_0.update_fail_htlcs.len(), 1);
nodes[0].node.handle_update_fail_htlc(nodes[1].node.get_our_node_id(), &updates_1_0.update_fail_htlcs[0]);
do_commitment_signed_dance(&nodes[0], &nodes[1], &updates_1_0.commitment_signed, false, false);
@@ -1140,7 +1140,7 @@ fn blinded_path_retries() {
nodes[3].node.process_pending_htlc_forwards();
check_added_monitors!(nodes[3], 1);
- let updates = get_htlc_update_msgs!(nodes[3], $intro_node.node.get_our_node_id());
+ let updates = get_htlc_update_msgs(&nodes[3], &$intro_node.node.get_our_node_id());
assert_eq!(updates.update_fail_malformed_htlcs.len(), 1);
let update_malformed = &updates.update_fail_malformed_htlcs[0];
assert_eq!(update_malformed.sha256_of_onion, [0; 32]);
@@ -1148,7 +1148,7 @@ fn blinded_path_retries() {
$intro_node.node.handle_update_fail_malformed_htlc(nodes[3].node.get_our_node_id(), update_malformed);
do_commitment_signed_dance(&$intro_node, &nodes[3], &updates.commitment_signed, true, false);
- let updates = get_htlc_update_msgs!($intro_node, nodes[0].node.get_our_node_id());
+ let updates = get_htlc_update_msgs(&$intro_node, &nodes[0].node.get_our_node_id());
assert_eq!(updates.update_fail_htlcs.len(), 1);
nodes[0].node.handle_update_fail_htlc($intro_node.node.get_our_node_id(), &updates.update_fail_htlcs[0]);
do_commitment_signed_dance(&nodes[0], &$intro_node, &updates.commitment_signed, false, false);
@@ -1256,7 +1256,7 @@ fn min_htlc() {
&[HTLCHandlingFailureType::Forward { node_id: Some(nodes[2].node.get_our_node_id()), channel_id: chan_1_2.2 }]
);
check_added_monitors(&nodes[1], 1);
- let mut updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let mut updates = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
nodes[0].node.handle_update_fail_htlc(nodes[1].node.get_our_node_id(), &updates.update_fail_htlcs[0]);
do_commitment_signed_dance(&nodes[0], &nodes[1], &updates.commitment_signed, false, false);
expect_payment_failed_conditions(&nodes[0], payment_hash, false,
@@ -1448,7 +1448,7 @@ fn fails_receive_tlvs_authentication() {
check_added_monitors!(nodes[1], 1);
expect_htlc_handling_failed_destinations!(nodes[1].node.get_and_clear_pending_events(), &[HTLCHandlingFailureType::InvalidOnion]);
- let mut update_fail = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let mut update_fail = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
assert!(update_fail.update_fail_htlcs.len() == 1);
let fail_msg = &update_fail.update_fail_htlcs[0];
nodes[0].node.handle_update_fail_htlc(nodes[1].node.get_our_node_id(), fail_msg);
@@ -2151,14 +2151,14 @@ fn test_trampoline_forward_payload_encoded_as_receive() {
do_pass_along_path(args);
{
- let unblinded_node_updates = get_htlc_update_msgs!(nodes[2], nodes[1].node.get_our_node_id());
+ let unblinded_node_updates = get_htlc_update_msgs(&nodes[2], &nodes[1].node.get_our_node_id());
nodes[1].node.handle_update_fail_htlc(
nodes[2].node.get_our_node_id(), &unblinded_node_updates.update_fail_htlcs[0]
);
do_commitment_signed_dance(&nodes[1], &nodes[2], &unblinded_node_updates.commitment_signed, true, false);
}
{
- let unblinded_node_updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let unblinded_node_updates = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
nodes[0].node.handle_update_fail_htlc(
nodes[1].node.get_our_node_id(), &unblinded_node_updates.update_fail_htlcs[0]
);
@@ -2526,14 +2526,14 @@ fn test_trampoline_forward_rejection() {
do_pass_along_path(args);
{
- let unblinded_node_updates = get_htlc_update_msgs!(nodes[2], nodes[1].node.get_our_node_id());
+ let unblinded_node_updates = get_htlc_update_msgs(&nodes[2], &nodes[1].node.get_our_node_id());
nodes[1].node.handle_update_fail_htlc(
nodes[2].node.get_our_node_id(), &unblinded_node_updates.update_fail_htlcs[0]
);
do_commitment_signed_dance(&nodes[1], &nodes[2], &unblinded_node_updates.commitment_signed, true, false);
}
{
- let unblinded_node_updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let unblinded_node_updates = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
nodes[0].node.handle_update_fail_htlc(
nodes[1].node.get_our_node_id(), &unblinded_node_updates.update_fail_htlcs[0]
);
diff --git a/lightning/src/ln/chanmon_update_fail_tests.rs b/lightning/src/ln/chanmon_update_fail_tests.rs
index 27c29b1..dd9e960 100644
--- a/lightning/src/ln/chanmon_update_fail_tests.rs
+++ b/lightning/src/ln/chanmon_update_fail_tests.rs
@@ -124,7 +124,7 @@ fn test_monitor_and_persister_update_fail() {
expect_payment_claimed!(nodes[1], payment_hash, 9_000_000);
check_added_monitors!(nodes[1], 1);
- let mut updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert_eq!(updates.update_fulfill_htlcs.len(), 1);
nodes[0].node.handle_update_fulfill_htlc(node_b_id, updates.update_fulfill_htlcs.remove(0));
@@ -562,7 +562,7 @@ fn do_test_monitor_temporary_update_fail(disconnect_count: usize) {
macro_rules! handle_bs_raa {
() => {
nodes[0].node.handle_revoke_and_ack(node_b_id, &bs_revoke_and_ack);
- as_commitment_update = get_htlc_update_msgs!(nodes[0], node_b_id);
+ as_commitment_update = get_htlc_update_msgs(&nodes[0], &node_b_id);
assert!(as_commitment_update.update_add_htlcs.is_empty());
assert!(as_commitment_update.update_fulfill_htlcs.is_empty());
assert!(as_commitment_update.update_fail_htlcs.is_empty());
@@ -575,7 +575,7 @@ fn do_test_monitor_temporary_update_fail(disconnect_count: usize) {
macro_rules! handle_initial_raa {
() => {
nodes[1].node.handle_revoke_and_ack(node_a_id, &initial_revoke_and_ack);
- bs_second_commitment_update = get_htlc_update_msgs!(nodes[1], node_a_id);
+ bs_second_commitment_update = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert!(bs_second_commitment_update.update_add_htlcs.is_empty());
assert!(bs_second_commitment_update.update_fulfill_htlcs.is_empty());
assert!(bs_second_commitment_update.update_fail_htlcs.is_empty());
@@ -944,7 +944,7 @@ fn test_monitor_update_raa_while_paused() {
let as_update_raa = get_revoke_commit_msgs(&nodes[0], &node_b_id);
nodes[1].node.handle_revoke_and_ack(node_a_id, &as_update_raa.0);
check_added_monitors!(nodes[1], 1);
- let bs_cs = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let bs_cs = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[1].node.handle_commitment_signed_batch_test(node_a_id, &as_update_raa.1);
check_added_monitors!(nodes[1], 1);
@@ -996,7 +996,7 @@ fn do_test_monitor_update_fail_raa(test_ignore_second_cs: bool) {
);
check_added_monitors!(nodes[2], 1);
- let updates = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let updates = get_htlc_update_msgs(&nodes[2], &node_b_id);
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fulfill_htlcs.is_empty());
assert_eq!(updates.update_fail_htlcs.len(), 1);
@@ -1143,7 +1143,7 @@ fn do_test_monitor_update_fail_raa(test_ignore_second_cs: bool) {
get_event_msg!(nodes[2], MessageSendEvent::SendRevokeAndACK, node_b_id);
nodes[2].node.handle_revoke_and_ack(node_b_id, &raa.unwrap());
check_added_monitors!(nodes[2], 1);
- let bs_cs = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let bs_cs = get_htlc_update_msgs(&nodes[2], &node_b_id);
assert!(bs_cs.update_add_htlcs.is_empty());
assert!(bs_cs.update_fail_htlcs.is_empty());
assert!(bs_cs.update_fail_malformed_htlcs.is_empty());
@@ -1152,7 +1152,7 @@ fn do_test_monitor_update_fail_raa(test_ignore_second_cs: bool) {
nodes[1].node.handle_revoke_and_ack(node_c_id, &bs_revoke_and_ack);
check_added_monitors!(nodes[1], 1);
- as_cs = get_htlc_update_msgs!(nodes[1], node_c_id);
+ as_cs = get_htlc_update_msgs(&nodes[1], &node_c_id);
nodes[1].node.handle_commitment_signed_batch_test(node_c_id, &bs_cs.commitment_signed);
check_added_monitors!(nodes[1], 1);
@@ -1172,7 +1172,7 @@ fn do_test_monitor_update_fail_raa(test_ignore_second_cs: bool) {
_ => panic!("Unexpected event"),
}
- as_cs = get_htlc_update_msgs!(nodes[1], node_c_id);
+ as_cs = get_htlc_update_msgs(&nodes[1], &node_c_id);
match bs_revoke_and_commit[1] {
MessageSendEvent::UpdateHTLCs { ref node_id, channel_id: _, ref updates } => {
@@ -1205,7 +1205,7 @@ fn do_test_monitor_update_fail_raa(test_ignore_second_cs: bool) {
nodes[2].node.handle_revoke_and_ack(node_b_id, &as_raa);
check_added_monitors!(nodes[2], 1);
- let bs_second_cs = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let bs_second_cs = get_htlc_update_msgs(&nodes[2], &node_b_id);
nodes[1].node.handle_revoke_and_ack(node_c_id, &bs_second_raa);
check_added_monitors!(nodes[1], 1);
@@ -1295,7 +1295,7 @@ fn test_monitor_update_fail_reestablish() {
check_added_monitors!(nodes[2], 1);
expect_payment_claimed!(nodes[2], payment_hash, 1_000_000);
- let mut updates = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let mut updates = get_htlc_update_msgs(&nodes[2], &node_b_id);
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fail_htlcs.is_empty());
assert!(updates.update_fail_malformed_htlcs.is_empty());
@@ -1357,7 +1357,7 @@ fn test_monitor_update_fail_reestablish() {
nodes[1].chain_monitor.chain_monitor.force_channel_monitor_updated(chan_1.2, latest_update);
check_added_monitors!(nodes[1], 0);
- updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fail_htlcs.is_empty());
assert!(updates.update_fail_malformed_htlcs.is_empty());
@@ -1474,7 +1474,7 @@ fn raa_no_response_awaiting_raa_state() {
check_added_monitors!(nodes[1], 1);
expect_and_process_pending_htlcs(&nodes[1], false);
expect_payment_claimable!(nodes[1], payment_hash_2, payment_secret_2, 1000000);
- let bs_update = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let bs_update = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_revoke_and_ack(node_b_id, &bs_raa);
check_added_monitors!(nodes[0], 1);
@@ -1556,7 +1556,7 @@ fn claim_while_disconnected_monitor_update_fail() {
nodes[0].node.send_payment_with_route(route, payment_hash_2, onion_2, id_2).unwrap();
check_added_monitors!(nodes[0], 1);
- let as_updates = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let as_updates = get_htlc_update_msgs(&nodes[0], &node_b_id);
nodes[1].node.handle_update_add_htlc(node_a_id, &as_updates.update_add_htlcs[0]);
nodes[1].node.handle_commitment_signed_batch_test(node_a_id, &as_updates.commitment_signed);
check_added_monitors!(nodes[1], 1);
@@ -1601,9 +1601,9 @@ fn claim_while_disconnected_monitor_update_fail() {
_ => panic!("Unexpected event"),
}
- let as_commitment = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let as_commitment = get_htlc_update_msgs(&nodes[0], &node_b_id);
- let bs_commitment = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let bs_commitment = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_commitment_signed_batch_test(node_b_id, &bs_commitment.commitment_signed);
check_added_monitors!(nodes[0], 1);
let as_raa = get_event_msg!(nodes[0], MessageSendEvent::SendRevokeAndACK, node_b_id);
@@ -1898,7 +1898,7 @@ fn test_monitor_update_fail_claim() {
expect_payment_claimed!(nodes[1], payment_hash_1, 1_000_000);
check_added_monitors!(nodes[1], 0);
- let mut bs_fulfill = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut bs_fulfill = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fulfill_htlc(node_b_id, bs_fulfill.update_fulfill_htlcs.remove(0));
do_commitment_signed_dance(&nodes[0], &nodes[1], &bs_fulfill.commitment_signed, false, false);
expect_payment_sent!(nodes[0], payment_preimage_1);
@@ -1906,7 +1906,7 @@ fn test_monitor_update_fail_claim() {
// Get the payment forwards, note that they were batched into one commitment update.
nodes[1].node.process_pending_htlc_forwards();
check_added_monitors!(nodes[1], 1);
- let bs_forward_update = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let bs_forward_update = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_add_htlc(node_b_id, &bs_forward_update.update_add_htlcs[0]);
nodes[0].node.handle_update_add_htlc(node_b_id, &bs_forward_update.update_add_htlcs[1]);
let commitment = &bs_forward_update.commitment_signed;
@@ -1996,7 +1996,7 @@ fn test_monitor_update_on_pending_forwards() {
);
check_added_monitors!(nodes[2], 1);
- let cs_fail_update = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let cs_fail_update = get_htlc_update_msgs(&nodes[2], &node_b_id);
nodes[1].node.handle_update_fail_htlc(node_c_id, &cs_fail_update.update_fail_htlcs[0]);
do_commitment_signed_dance(&nodes[1], &nodes[2], &cs_fail_update.commitment_signed, true, true);
assert!(nodes[1].node.get_and_clear_pending_msg_events().is_empty());
@@ -2026,7 +2026,7 @@ fn test_monitor_update_on_pending_forwards() {
nodes[1].chain_monitor.chain_monitor.force_channel_monitor_updated(chan_1.2, latest_update);
check_added_monitors!(nodes[1], 0);
- let bs_updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let bs_updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fail_htlc(node_b_id, &bs_updates.update_fail_htlcs[0]);
nodes[0].node.handle_update_add_htlc(node_b_id, &bs_updates.update_add_htlcs[0]);
do_commitment_signed_dance(&nodes[0], &nodes[1], &bs_updates.commitment_signed, false, true);
@@ -2104,7 +2104,7 @@ fn monitor_update_claim_fail_no_response() {
expect_and_process_pending_htlcs(&nodes[1], false);
expect_payment_claimable!(nodes[1], payment_hash_2, payment_secret_2, 1000000);
- let mut bs_updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut bs_updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fulfill_htlc(node_b_id, bs_updates.update_fulfill_htlcs.remove(0));
do_commitment_signed_dance(&nodes[0], &nodes[1], &bs_updates.commitment_signed, false, false);
expect_payment_sent!(nodes[0], payment_preimage_1);
@@ -2383,7 +2383,7 @@ fn test_pending_update_fee_ack_on_reconnect() {
let id = PaymentId(payment_hash.0);
nodes[1].node.send_payment_with_route(route, payment_hash, onion, id).unwrap();
check_added_monitors!(nodes[1], 1);
- let bs_initial_send_msgs = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let bs_initial_send_msgs = get_htlc_update_msgs(&nodes[1], &node_a_id);
// bs_initial_send_msgs are not delivered until they are re-generated after reconnect
{
@@ -2392,7 +2392,7 @@ fn test_pending_update_fee_ack_on_reconnect() {
}
nodes[0].node.timer_tick_occurred();
check_added_monitors!(nodes[0], 1);
- let as_update_fee_msgs = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let as_update_fee_msgs = get_htlc_update_msgs(&nodes[0], &node_b_id);
assert!(as_update_fee_msgs.update_fee.is_some());
nodes[1].node.handle_update_fee(node_a_id, as_update_fee_msgs.update_fee.as_ref().unwrap());
@@ -2447,13 +2447,13 @@ fn test_pending_update_fee_ack_on_reconnect() {
&get_event_msg!(nodes[0], MessageSendEvent::SendRevokeAndACK, node_b_id),
);
check_added_monitors!(nodes[1], 1);
- let bs_second_cs = get_htlc_update_msgs!(nodes[1], node_a_id).commitment_signed;
+ let bs_second_cs = get_htlc_update_msgs(&nodes[1], &node_a_id).commitment_signed;
nodes[0].node.handle_revoke_and_ack(node_b_id, &bs_first_raa);
check_added_monitors!(nodes[0], 1);
nodes[1].node.handle_commitment_signed_batch_test(
node_a_id,
- &get_htlc_update_msgs!(nodes[0], node_b_id).commitment_signed,
+ &get_htlc_update_msgs(&nodes[0], &node_b_id).commitment_signed,
);
check_added_monitors!(nodes[1], 1);
let bs_third_raa = get_event_msg!(nodes[1], MessageSendEvent::SendRevokeAndACK, node_a_id);
@@ -2507,9 +2507,9 @@ fn test_fail_htlc_on_broadcast_after_claim() {
check_added_monitors!(nodes[2], 1);
expect_payment_claimed!(nodes[2], payment_hash, 2000);
- let mut cs_updates = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let mut cs_updates = get_htlc_update_msgs(&nodes[2], &node_b_id);
nodes[1].node.handle_update_fulfill_htlc(node_c_id, cs_updates.update_fulfill_htlcs.remove(0));
- let mut bs_updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut bs_updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
check_added_monitors!(nodes[1], 1);
expect_payment_forwarded!(nodes[1], nodes[0], nodes[2], Some(1000), false, false);
@@ -2550,7 +2550,7 @@ fn do_update_fee_resend_test(deliver_update: bool, parallel_updates: bool) {
}
nodes[0].node.timer_tick_occurred();
check_added_monitors!(nodes[0], 1);
- let update_msgs = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let update_msgs = get_htlc_update_msgs(&nodes[0], &node_b_id);
assert!(update_msgs.update_fee.is_some());
if deliver_update {
nodes[1].node.handle_update_fee(node_a_id, update_msgs.update_fee.as_ref().unwrap());
@@ -2605,7 +2605,7 @@ fn do_update_fee_resend_test(deliver_update: bool, parallel_updates: bool) {
let (bs_first_raa, bs_first_cs) = get_revoke_commit_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_revoke_and_ack(node_b_id, &bs_first_raa);
check_added_monitors!(nodes[0], 1);
- let as_second_update = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let as_second_update = get_htlc_update_msgs(&nodes[0], &node_b_id);
nodes[0].node.handle_commitment_signed_batch_test(node_b_id, &bs_first_cs);
check_added_monitors!(nodes[0], 1);
@@ -2619,7 +2619,7 @@ fn do_update_fee_resend_test(deliver_update: bool, parallel_updates: bool) {
let bs_second_raa = get_event_msg!(nodes[1], MessageSendEvent::SendRevokeAndACK, node_a_id);
nodes[1].node.handle_revoke_and_ack(node_a_id, &as_first_raa);
- let bs_second_cs = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let bs_second_cs = get_htlc_update_msgs(&nodes[1], &node_a_id);
check_added_monitors!(nodes[1], 1);
nodes[0].node.handle_revoke_and_ack(node_b_id, &bs_second_raa);
@@ -2914,7 +2914,7 @@ fn do_test_reconnect_dup_htlc_claims(htlc_status: HTLCStatusAtDupClaim, second_f
&[HTLCHandlingFailureType::Receive { payment_hash }],
);
check_added_monitors!(nodes[2], 1);
- get_htlc_update_msgs!(nodes[2], node_b_id);
+ get_htlc_update_msgs(&nodes[2], &node_b_id);
// Note that we don't populate fulfill_msg.attribution_data here, which will lead to hold times being
// unavailable.
} else {
@@ -2922,7 +2922,7 @@ fn do_test_reconnect_dup_htlc_claims(htlc_status: HTLCStatusAtDupClaim, second_f
check_added_monitors!(nodes[2], 1);
expect_payment_claimed!(nodes[2], payment_hash, 100_000);
- let cs_updates = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let cs_updates = get_htlc_update_msgs(&nodes[2], &node_b_id);
assert_eq!(cs_updates.update_fulfill_htlcs.len(), 1);
// Check that the message we're about to deliver matches the one generated. Ignore attribution data.
@@ -2940,7 +2940,7 @@ fn do_test_reconnect_dup_htlc_claims(htlc_status: HTLCStatusAtDupClaim, second_f
let mut bs_updates = None;
if htlc_status != HTLCStatusAtDupClaim::HoldingCell {
- bs_updates = Some(get_htlc_update_msgs!(nodes[1], node_a_id));
+ bs_updates = Some(get_htlc_update_msgs(&nodes[1], &node_a_id));
assert_eq!(bs_updates.as_ref().unwrap().update_fulfill_htlcs.len(), 1);
nodes[0].node.handle_update_fulfill_htlc(
node_b_id,
@@ -2978,7 +2978,7 @@ fn do_test_reconnect_dup_htlc_claims(htlc_status: HTLCStatusAtDupClaim, second_f
check_added_monitors!(nodes[1], 1);
expect_htlc_failure_conditions(nodes[1].node.get_and_clear_pending_events(), &[]); // We finally receive the second payment, but don't claim it
- bs_updates = Some(get_htlc_update_msgs!(nodes[1], node_a_id));
+ bs_updates = Some(get_htlc_update_msgs(&nodes[1], &node_a_id));
assert_eq!(bs_updates.as_ref().unwrap().update_fulfill_htlcs.len(), 1);
nodes[0].node.handle_update_fulfill_htlc(
node_b_id,
@@ -3468,7 +3468,7 @@ fn do_test_blocked_chan_preimage_release(completion_mode: BlockedUpdateComplMode
check_added_monitors(&nodes[2], 1);
expect_payment_claimed!(nodes[2], payment_hash_1, 1_000_000);
- let mut cs_htlc_fulfill = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let mut cs_htlc_fulfill = get_htlc_update_msgs(&nodes[2], &node_b_id);
nodes[1]
.node
.handle_update_fulfill_htlc(node_c_id, cs_htlc_fulfill.update_fulfill_htlcs.remove(0));
@@ -3483,7 +3483,7 @@ fn do_test_blocked_chan_preimage_release(completion_mode: BlockedUpdateComplMode
check_added_monitors(&nodes[0], 1);
expect_payment_claimed!(nodes[0], payment_hash_2, 1_000_000);
- let mut as_htlc_fulfill = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let mut as_htlc_fulfill = get_htlc_update_msgs(&nodes[0], &node_b_id);
if completion_mode != BlockedUpdateComplMode::Sync {
// We use to incorrectly handle monitor update completion in cases where we completed a
// monitor update async or after reload. We test both based on the `completion_mode`.
@@ -3559,7 +3559,7 @@ fn do_test_blocked_chan_preimage_release(completion_mode: BlockedUpdateComplMode
// When we fetch the next update the message getter will generate the next update for nodes[2],
// generating a further monitor update.
- let mut bs_htlc_fulfill = get_htlc_update_msgs!(nodes[1], node_c_id);
+ let mut bs_htlc_fulfill = get_htlc_update_msgs(&nodes[1], &node_c_id);
check_added_monitors(&nodes[1], 1);
nodes[2]
@@ -4510,7 +4510,7 @@ fn test_claim_to_closed_channel_blocks_forwarded_preimage_removal() {
check_added_monitors!(nodes[2], 1);
expect_payment_claimed!(nodes[2], payment_hash, 1_000_000);
- let mut updates = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let mut updates = get_htlc_update_msgs(&nodes[2], &node_b_id);
chanmon_cfgs[1].persister.set_update_ret(ChannelMonitorUpdateStatus::InProgress);
nodes[1].node.handle_update_fulfill_htlc(node_c_id, updates.update_fulfill_htlcs.remove(0));
check_added_monitors!(nodes[1], 1);
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index 8abb237..bfddce7 100644
--- a/lightning/src/ln/channelmanager.rs
+++ b/lightning/src/ln/channelmanager.rs
@@ -18559,7 +18559,7 @@ mod tests {
let fail = HTLCHandlingFailureType::Receive { payment_hash: our_payment_hash };
expect_htlc_failure_conditions(events, &[fail]);
check_added_monitors!(nodes[1], 1);
- let updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let updates = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fulfill_htlcs.is_empty());
assert_eq!(updates.update_fail_htlcs.len(), 1);
@@ -18585,7 +18585,7 @@ mod tests {
expect_payment_claimed!(nodes[1], our_payment_hash, 200_000);
check_added_monitors!(nodes[1], 2);
- let mut bs_1st_updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let mut bs_1st_updates = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
nodes[0].node.handle_update_fulfill_htlc(nodes[1].node.get_our_node_id(), bs_1st_updates.update_fulfill_htlcs.remove(0));
expect_payment_sent(&nodes[0], payment_preimage, None, false, false);
nodes[0].node.handle_commitment_signed_batch_test(nodes[1].node.get_our_node_id(), &bs_1st_updates.commitment_signed);
@@ -18593,7 +18593,7 @@ mod tests {
let (as_first_raa, as_first_cs) = get_revoke_commit_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
nodes[1].node.handle_revoke_and_ack(nodes[0].node.get_our_node_id(), &as_first_raa);
check_added_monitors!(nodes[1], 1);
- let mut bs_2nd_updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let mut bs_2nd_updates = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
nodes[1].node.handle_commitment_signed_batch_test(nodes[0].node.get_our_node_id(), &as_first_cs);
check_added_monitors!(nodes[1], 1);
let bs_first_raa = get_event_msg!(nodes[1], MessageSendEvent::SendRevokeAndACK, nodes[0].node.get_our_node_id());
@@ -18602,7 +18602,7 @@ mod tests {
check_added_monitors!(nodes[0], 1);
let as_second_raa = get_event_msg!(nodes[0], MessageSendEvent::SendRevokeAndACK, nodes[1].node.get_our_node_id());
nodes[0].node.handle_revoke_and_ack(nodes[1].node.get_our_node_id(), &bs_first_raa);
- let as_second_updates = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
+ let as_second_updates = get_htlc_update_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
check_added_monitors!(nodes[0], 1);
nodes[1].node.handle_revoke_and_ack(nodes[0].node.get_our_node_id(), &as_second_raa);
check_added_monitors!(nodes[1], 1);
@@ -18679,7 +18679,7 @@ mod tests {
let fail = HTLCHandlingFailureType::Receive { payment_hash };
expect_htlc_failure_conditions(events, &[fail]);
check_added_monitors!(nodes[1], 1);
- let updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let updates = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fulfill_htlcs.is_empty());
assert_eq!(updates.update_fail_htlcs.len(), 1);
@@ -18726,7 +18726,7 @@ mod tests {
let fail = HTLCHandlingFailureType::Receive { payment_hash };
expect_htlc_failure_conditions(events, &[fail]);
check_added_monitors!(nodes[1], 1);
- let updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let updates = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fulfill_htlcs.is_empty());
assert_eq!(updates.update_fail_htlcs.len(), 1);
@@ -18775,7 +18775,7 @@ mod tests {
let fail = HTLCHandlingFailureType::Receive { payment_hash };
expect_htlc_failure_conditions(events, &[fail]);
check_added_monitors!(nodes[1], 1);
- let updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let updates = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fulfill_htlcs.is_empty());
assert_eq!(updates.update_fail_htlcs.len(), 1);
@@ -18822,7 +18822,7 @@ mod tests {
RecipientOnionFields::spontaneous_empty(), Some(test_preimage), PaymentId(mismatch_payment_hash.0), None, session_privs).unwrap();
check_added_monitors!(nodes[0], 1);
- let updates = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
+ let updates = get_htlc_update_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
assert_eq!(updates.update_add_htlcs.len(), 1);
assert!(updates.update_fulfill_htlcs.is_empty());
assert!(updates.update_fail_htlcs.is_empty());
@@ -18833,7 +18833,7 @@ mod tests {
expect_and_process_pending_htlcs(&nodes[1], false);
expect_htlc_handling_failed_destinations!(nodes[1].node.get_and_clear_pending_events(), &[HTLCHandlingFailureType::Receive { payment_hash: mismatch_payment_hash }]);
check_added_monitors(&nodes[1], 1);
- let _ = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let _ = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
nodes[1].logger.assert_log_contains("lightning::ln::channelmanager", "Payment preimage didn't match payment hash", 1);
}
diff --git a/lightning/src/ln/functional_test_utils.rs b/lightning/src/ln/functional_test_utils.rs
index 5fac0fd..987ef27 100644
--- a/lightning/src/ln/functional_test_utils.rs
+++ b/lightning/src/ln/functional_test_utils.rs
@@ -1103,16 +1103,6 @@ pub fn get_htlc_update_msgs(node: &Node, recipient: &PublicKey) -> msgs::Commitm
}
}
-#[macro_export]
-/// Gets an UpdateHTLCs MessageSendEvent
-///
-/// Don't use this, use the identically-named function instead.
-macro_rules! get_htlc_update_msgs {
- ($node: expr, $node_id: expr) => {
- $crate::ln::functional_test_utils::get_htlc_update_msgs(&$node, &$node_id)
- };
-}
-
/// Fetches the first `msg_event` to the passed `node_id` in the passed `msg_events` vec.
/// Returns the `msg_event`.
///
@@ -3442,7 +3432,7 @@ fn fail_payment_along_path<'a, 'b, 'c>(expected_path: &[&Node<'a, 'b, 'c>]) {
// iterate from the receiving node to the origin node and handle update fail htlc.
for (&node, &prev_node) in expected_path.iter().rev().zip(expected_path.iter().rev().skip(1)) {
- let updates = get_htlc_update_msgs!(node, prev_node.node.get_our_node_id());
+ let updates = get_htlc_update_msgs(node, &prev_node.node.get_our_node_id());
prev_node
.node
.handle_update_fail_htlc(node.node.get_our_node_id(), &updates.update_fail_htlcs[0]);
diff --git a/lightning/src/ln/functional_tests.rs b/lightning/src/ln/functional_tests.rs
index 8f3c94b..4f3b7ba 100644
--- a/lightning/src/ln/functional_tests.rs
+++ b/lightning/src/ln/functional_tests.rs
@@ -1429,7 +1429,7 @@ pub fn test_htlc_on_chain_success() {
nodes[2].node.claim_funds(our_payment_preimage_2);
expect_payment_claimed!(nodes[2], payment_hash_2, 3_000_000);
check_added_monitors(&nodes[2], 2);
- let updates = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let updates = get_htlc_update_msgs(&nodes[2], &node_b_id);
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fail_htlcs.is_empty());
assert!(updates.update_fail_malformed_htlcs.is_empty());
@@ -1927,7 +1927,7 @@ fn do_test_commitment_revoked_fail_backward_exhaustive(
&[HTLCHandlingFailureType::Receive { payment_hash: first_payment_hash }],
);
check_added_monitors(&nodes[2], 1);
- let updates = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let updates = get_htlc_update_msgs(&nodes[2], &node_b_id);
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fulfill_htlcs.is_empty());
assert!(updates.update_fail_malformed_htlcs.is_empty());
@@ -1944,7 +1944,7 @@ fn do_test_commitment_revoked_fail_backward_exhaustive(
&[HTLCHandlingFailureType::Receive { payment_hash: second_payment_hash }],
);
check_added_monitors(&nodes[2], 1);
- let updates = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let updates = get_htlc_update_msgs(&nodes[2], &node_b_id);
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fulfill_htlcs.is_empty());
assert!(updates.update_fail_malformed_htlcs.is_empty());
@@ -1964,7 +1964,7 @@ fn do_test_commitment_revoked_fail_backward_exhaustive(
&[HTLCHandlingFailureType::Receive { payment_hash: third_payment_hash }],
);
check_added_monitors(&nodes[2], 1);
- let updates = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let updates = get_htlc_update_msgs(&nodes[2], &node_b_id);
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fulfill_htlcs.is_empty());
assert!(updates.update_fail_malformed_htlcs.is_empty());
@@ -2471,7 +2471,7 @@ pub fn test_dup_events_on_peer_disconnect() {
nodes[1].node.claim_funds(payment_preimage);
expect_payment_claimed!(nodes[1], payment_hash, 1_000_000);
check_added_monitors(&nodes[1], 1);
- let mut claim_msgs = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut claim_msgs = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fulfill_htlc(node_b_id, claim_msgs.update_fulfill_htlcs.remove(0));
expect_payment_sent(&nodes[0], payment_preimage, None, false, false);
@@ -3171,7 +3171,7 @@ pub fn test_drop_messages_peer_disconnect_dual_htlc() {
check_added_monitors(&nodes[1], 1);
nodes[1].node.handle_revoke_and_ack(node_a_id, as_resp.1.as_ref().unwrap());
- let bs_second_commitment_signed = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let bs_second_commitment_signed = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert!(bs_second_commitment_signed.update_add_htlcs.is_empty());
assert!(bs_second_commitment_signed.update_fulfill_htlcs.is_empty());
assert!(bs_second_commitment_signed.update_fail_htlcs.is_empty());
@@ -3180,7 +3180,7 @@ pub fn test_drop_messages_peer_disconnect_dual_htlc() {
check_added_monitors(&nodes[1], 1);
nodes[0].node.handle_revoke_and_ack(node_b_id, &bs_revoke_and_ack);
- let as_commitment_signed = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let as_commitment_signed = get_htlc_update_msgs(&nodes[0], &node_b_id);
assert!(as_commitment_signed.update_add_htlcs.is_empty());
assert!(as_commitment_signed.update_fulfill_htlcs.is_empty());
assert!(as_commitment_signed.update_fail_htlcs.is_empty());
@@ -3312,7 +3312,7 @@ fn do_test_htlc_timeout(send_partial_mpp: bool) {
);
check_added_monitors(&nodes[1], 1);
- let htlc_timeout_updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let htlc_timeout_updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert!(htlc_timeout_updates.update_add_htlcs.is_empty());
assert_eq!(htlc_timeout_updates.update_fail_htlcs.len(), 1);
assert!(htlc_timeout_updates.update_fail_malformed_htlcs.is_empty());
@@ -3923,7 +3923,7 @@ pub fn test_onchain_to_onchain_claim() {
nodes[2].node.claim_funds(payment_preimage);
expect_payment_claimed!(nodes[2], payment_hash, 3_000_000);
check_added_monitors(&nodes[2], 1);
- let updates = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let updates = get_htlc_update_msgs(&nodes[2], &node_b_id);
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fail_htlcs.is_empty());
assert_eq!(updates.update_fulfill_htlcs.len(), 1);
@@ -4127,9 +4127,9 @@ pub fn test_duplicate_payment_hash_one_failure_one_success() {
nodes[4].node.claim_funds(our_payment_preimage);
expect_payment_claimed!(nodes[4], dup_payment_hash, 800_000);
check_added_monitors(&nodes[4], 1);
- let mut updates = get_htlc_update_msgs!(nodes[4], node_c_id);
+ let mut updates = get_htlc_update_msgs(&nodes[4], &node_c_id);
nodes[2].node.handle_update_fulfill_htlc(node_e_id, updates.update_fulfill_htlcs.remove(0));
- let _cs_updates = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let _cs_updates = get_htlc_update_msgs(&nodes[2], &node_b_id);
expect_payment_forwarded!(nodes[2], nodes[1], nodes[4], Some(196), false, false);
check_added_monitors(&nodes[2], 1);
do_commitment_signed_dance(&nodes[2], &nodes[4], &updates.commitment_signed, false, false);
@@ -4182,7 +4182,7 @@ pub fn test_duplicate_payment_hash_one_failure_one_success() {
&nodes[1],
&[HTLCHandlingFailureType::Forward { node_id: Some(node_c_id), channel_id: chan_2.2 }],
);
- let htlc_updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let htlc_updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert!(htlc_updates.update_add_htlcs.is_empty());
assert_eq!(htlc_updates.update_fail_htlcs.len(), 1);
let first_htlc_id = htlc_updates.update_fail_htlcs[0].htlc_id;
@@ -4200,7 +4200,7 @@ pub fn test_duplicate_payment_hash_one_failure_one_success() {
// provide to node A.
mine_transaction(&nodes[1], htlc_success_tx_to_confirm);
expect_payment_forwarded!(nodes[1], nodes[0], nodes[2], Some(392), true, true);
- let mut updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fail_htlcs.is_empty());
assert_eq!(updates.update_fulfill_htlcs.len(), 1);
@@ -4404,7 +4404,7 @@ fn do_test_fail_backwards_unrevoked_remote_announce(deliver_last_raa: bool, anno
expect_and_process_pending_htlcs_and_htlc_handling_failed(&nodes[4], &failed_destinations);
check_added_monitors(&nodes[4], 1);
- let four_removes = get_htlc_update_msgs!(nodes[4], node_d_id);
+ let four_removes = get_htlc_update_msgs(&nodes[4], &node_d_id);
nodes[3].node.handle_update_fail_htlc(node_e_id, &four_removes.update_fail_htlcs[0]);
nodes[3].node.handle_update_fail_htlc(node_e_id, &four_removes.update_fail_htlcs[1]);
nodes[3].node.handle_update_fail_htlc(node_e_id, &four_removes.update_fail_htlcs[2]);
@@ -4423,7 +4423,7 @@ fn do_test_fail_backwards_unrevoked_remote_announce(deliver_last_raa: bool, anno
expect_and_process_pending_htlcs_and_htlc_handling_failed(&nodes[5], &failed_destinations_2);
check_added_monitors(&nodes[5], 1);
- let two_removes = get_htlc_update_msgs!(nodes[5], node_d_id);
+ let two_removes = get_htlc_update_msgs(&nodes[5], &node_d_id);
nodes[3].node.handle_update_fail_htlc(node_f_id, &two_removes.update_fail_htlcs[0]);
nodes[3].node.handle_update_fail_htlc(node_f_id, &two_removes.update_fail_htlcs[1]);
do_commitment_signed_dance(&nodes[3], &nodes[5], &two_removes.commitment_signed, false, false);
@@ -4441,7 +4441,7 @@ fn do_test_fail_backwards_unrevoked_remote_announce(deliver_last_raa: bool, anno
];
expect_and_process_pending_htlcs_and_htlc_handling_failed(&nodes[3], &failed_destinations_3);
check_added_monitors(&nodes[3], 1);
- let six_removes = get_htlc_update_msgs!(nodes[3], node_c_id);
+ let six_removes = get_htlc_update_msgs(&nodes[3], &node_c_id);
nodes[2].node.handle_update_fail_htlc(node_d_id, &six_removes.update_fail_htlcs[0]);
nodes[2].node.handle_update_fail_htlc(node_d_id, &six_removes.update_fail_htlcs[1]);
nodes[2].node.handle_update_fail_htlc(node_d_id, &six_removes.update_fail_htlcs[2]);
@@ -4928,7 +4928,7 @@ fn do_htlc_claim_local_commitment_only(use_dust: bool) {
check_added_monitors(&nodes[1], 1);
expect_payment_claimed!(nodes[1], payment_hash, if use_dust { 50000 } else { 3_000_000 });
- let mut bs_updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut bs_updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fulfill_htlc(node_b_id, bs_updates.update_fulfill_htlcs.remove(0));
expect_payment_sent(&nodes[0], payment_preimage, None, false, false);
@@ -4969,7 +4969,7 @@ fn do_htlc_claim_current_remote_commitment_only(use_dust: bool) {
nodes[0].node.send_payment_with_route(route, payment_hash, onion, id).unwrap();
check_added_monitors(&nodes[0], 1);
- let _as_update = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let _as_update = get_htlc_update_msgs(&nodes[0], &node_b_id);
// As far as A is concerned, the HTLC is now present only in the latest remote commitment
// transaction, however it is not in A's latest local commitment, so we can just broadcast that
@@ -5015,7 +5015,7 @@ fn do_htlc_claim_previous_remote_commitment_only(use_dust: bool, check_revoke_no
);
check_added_monitors(&nodes[1], 1);
- let bs_updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let bs_updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fail_htlc(node_b_id, &bs_updates.update_fail_htlcs[0]);
nodes[0].node.handle_commitment_signed_batch_test(node_b_id, &bs_updates.commitment_signed);
check_added_monitors(&nodes[0], 1);
@@ -5313,7 +5313,7 @@ pub fn test_free_and_fail_holding_cell_htlcs() {
check_added_monitors(&nodes[1], 1);
expect_payment_claimed!(nodes[1], payment_hash_1, amt_1);
- let mut update_msgs = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut update_msgs = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fulfill_htlc(node_b_id, update_msgs.update_fulfill_htlcs.remove(0));
do_commitment_signed_dance(&nodes[0], &nodes[1], &update_msgs.commitment_signed, false, true);
expect_payment_sent!(nodes[0], payment_preimage_1);
@@ -5728,7 +5728,7 @@ fn do_test_failure_delay_dust_htlc_local_commitment(announce_latest: bool) {
);
check_added_monitors(&nodes[1], 1);
- let remove = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let remove = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fail_htlc(node_b_id, &remove.update_fail_htlcs[0]);
nodes[0].node.handle_commitment_signed_batch_test(node_b_id, &remove.commitment_signed);
check_added_monitors(&nodes[0], 1);
@@ -7287,7 +7287,7 @@ pub fn test_update_err_monitor_lockdown() {
check_added_monitors(&nodes[1], 1);
expect_payment_claimed!(nodes[1], payment_hash, 9_000_000);
- let mut updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert_eq!(updates.update_fulfill_htlcs.len(), 1);
nodes[0].node.handle_update_fulfill_htlc(node_b_id, updates.update_fulfill_htlcs.remove(0));
{
@@ -7443,7 +7443,7 @@ pub fn test_concurrent_monitor_claim() {
nodes[1].node.send_payment_with_route(route, payment_hash, onion, id).unwrap();
check_added_monitors(&nodes[1], 1);
- let updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert_eq!(updates.update_add_htlcs.len(), 1);
nodes[0].node.handle_update_add_htlc(node_b_id, &updates.update_add_htlcs[0]);
{
@@ -7711,7 +7711,7 @@ fn do_test_onchain_htlc_settlement_after_close(
check_added_monitors(&nodes[2], 1);
expect_payment_claimed!(nodes[2], payment_hash, 3_000_000);
- let mut carol_updates = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let mut carol_updates = get_htlc_update_msgs(&nodes[2], &node_b_id);
assert!(carol_updates.update_add_htlcs.is_empty());
assert!(carol_updates.update_fail_htlcs.is_empty());
assert!(carol_updates.update_fail_malformed_htlcs.is_empty());
@@ -8116,7 +8116,7 @@ fn do_test_tx_confirmed_skipping_blocks_immediate_broadcast(test_height_before_t
);
check_added_monitors(&nodes[1], 1);
- let updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fulfill_htlcs.is_empty());
assert_eq!(updates.update_fail_htlcs.len(), 1);
@@ -8223,7 +8223,7 @@ fn do_test_dup_htlc_second_rejected(test_for_second_fail_panic: bool) {
nodes[1].node.process_pending_htlc_forwards();
check_added_monitors(&nodes[1], 1);
- let fail_updates_1 = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let fail_updates_1 = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert_eq!(fail_updates_1.update_fail_htlcs.len(), 2);
nodes[0].node.handle_update_fail_htlc(node_b_id, &fail_updates_1.update_fail_htlcs[0]);
@@ -8258,7 +8258,7 @@ fn do_test_dup_htlc_second_rejected(test_for_second_fail_panic: bool) {
nodes[1].node.process_pending_htlc_forwards();
check_added_monitors(&nodes[1], 1);
- let fail_updates_1 = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let fail_updates_1 = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fail_htlc(node_b_id, &fail_updates_1.update_fail_htlcs[0]);
let commitment = &fail_updates_1.commitment_signed;
do_commitment_signed_dance(&nodes[0], &nodes[1], commitment, false, false);
@@ -8391,7 +8391,7 @@ pub fn test_inconsistent_mpp_params() {
check_added_monitors(&nodes[3], 1);
- let fail_updates_1 = get_htlc_update_msgs!(nodes[3], node_c_id);
+ let fail_updates_1 = get_htlc_update_msgs(&nodes[3], &node_c_id);
nodes[2].node.handle_update_fail_htlc(node_d_id, &fail_updates_1.update_fail_htlcs[0]);
let commitment = &fail_updates_1.commitment_signed;
do_commitment_signed_dance(&nodes[2], &nodes[3], commitment, false, false);
@@ -8402,7 +8402,7 @@ pub fn test_inconsistent_mpp_params() {
);
check_added_monitors(&nodes[2], 1);
- let fail_updates_2 = get_htlc_update_msgs!(nodes[2], node_a_id);
+ let fail_updates_2 = get_htlc_update_msgs(&nodes[2], &node_a_id);
nodes[0].node.handle_update_fail_htlc(node_c_id, &fail_updates_2.update_fail_htlcs[0]);
let commitment = &fail_updates_2.commitment_signed;
do_commitment_signed_dance(&nodes[0], &nodes[2], commitment, false, false);
@@ -9018,7 +9018,7 @@ pub fn test_nondust_htlc_excess_fees_are_dust() {
check_added_monitors(&nodes[0], 1);
// Clear the failed htlc
- let updates = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let updates = get_htlc_update_msgs(&nodes[0], &node_b_id);
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fulfill_htlcs.is_empty());
assert_eq!(updates.update_fail_htlcs.len(), 1);
@@ -9194,7 +9194,7 @@ fn do_test_nondust_htlc_fees_dust_exposure_delta(features: ChannelTypeFeatures)
check_added_monitors(&nodes[1], 1);
// Clear the failed htlc
- let updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fulfill_htlcs.is_empty());
assert_eq!(updates.update_fail_htlcs.len(), 1);
@@ -9362,7 +9362,7 @@ fn do_payment_with_custom_min_final_cltv_expiry(valid_delta: bool, use_user_hash
check_added_monitors(&nodes[1], 1);
- let fail_updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let fail_updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fail_htlc(node_b_id, &fail_updates.update_fail_htlcs[0]);
let commitment = &fail_updates.commitment_signed;
do_commitment_signed_dance(&nodes[0], &nodes[1], commitment, false, true);
@@ -9803,7 +9803,7 @@ fn do_test_multi_post_event_actions(do_reload: bool) {
expect_payment_claimed!(nodes[2], payment_hash_2, 1_000_000);
for dest in &[1, 2] {
- let mut htlc_fulfill = get_htlc_update_msgs!(nodes[*dest], node_a_id);
+ let mut htlc_fulfill = get_htlc_update_msgs(&nodes[*dest], &node_a_id);
let dest_node_id = nodes[*dest].node.get_our_node_id();
nodes[0]
.node
diff --git a/lightning/src/ln/htlc_reserve_unit_tests.rs b/lightning/src/ln/htlc_reserve_unit_tests.rs
index 3a1fc87..11a5c52 100644
--- a/lightning/src/ln/htlc_reserve_unit_tests.rs
+++ b/lightning/src/ln/htlc_reserve_unit_tests.rs
@@ -332,7 +332,7 @@ pub fn test_channel_reserve_holding_cell_htlcs() {
// the pending htlc should be promoted to committed
nodes[0].node.handle_revoke_and_ack(node_b_id, &as_revoke_and_ack);
check_added_monitors(&nodes[0], 1);
- let commitment_update_2 = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let commitment_update_2 = get_htlc_update_msgs(&nodes[0], &node_b_id);
nodes[0].node.handle_commitment_signed_batch_test(node_b_id, &as_commitment_signed);
let bs_revoke_and_ack = get_event_msg!(nodes[0], MessageSendEvent::SendRevokeAndACK, node_b_id);
@@ -507,7 +507,7 @@ pub fn channel_reserve_in_flight_removes() {
nodes[1].node.claim_funds(payment_preimage_1);
expect_payment_claimed!(nodes[1], payment_hash_1, payment_value_1);
check_added_monitors(&nodes[1], 1);
- let mut bs_removes = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut bs_removes = get_htlc_update_msgs(&nodes[1], &node_a_id);
// This claim goes in B's holding cell, allowing us to have a pending B->A RAA which does not
// remove the second HTLC when we send the HTLC back from B to A.
@@ -530,11 +530,11 @@ pub fn channel_reserve_in_flight_removes() {
nodes[1].node.handle_revoke_and_ack(node_a_id, &as_raa);
check_added_monitors(&nodes[1], 1);
- let mut bs_cs = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut bs_cs = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_revoke_and_ack(node_b_id, &bs_raa);
check_added_monitors(&nodes[0], 1);
- let as_cs = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let as_cs = get_htlc_update_msgs(&nodes[0], &node_b_id);
nodes[1].node.handle_commitment_signed_batch_test(node_a_id, &as_cs.commitment_signed);
check_added_monitors(&nodes[1], 1);
@@ -563,7 +563,7 @@ pub fn channel_reserve_in_flight_removes() {
nodes[0].node.handle_revoke_and_ack(node_b_id, &bs_raa);
check_added_monitors(&nodes[0], 1);
expect_payment_path_successful!(nodes[0]);
- let as_cs = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let as_cs = get_htlc_update_msgs(&nodes[0], &node_b_id);
// Now that B doesn't have the second RAA anymore, but A still does, send a payment from B back
// to A to ensure that A doesn't count the almost-removed HTLC in update_add processing.
@@ -596,7 +596,7 @@ pub fn channel_reserve_in_flight_removes() {
nodes[0].node.handle_revoke_and_ack(node_b_id, &bs_raa);
check_added_monitors(&nodes[0], 1);
expect_payment_path_successful!(nodes[0]);
- let as_cs = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let as_cs = get_htlc_update_msgs(&nodes[0], &node_b_id);
nodes[1].node.handle_commitment_signed_batch_test(node_a_id, &as_cs.commitment_signed);
check_added_monitors(&nodes[1], 1);
@@ -683,7 +683,7 @@ pub fn holding_cell_htlc_counting() {
expect_htlc_failure_conditions(events, &[fail]);
check_added_monitors(&nodes[1], 1);
- let bs_fail_updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let bs_fail_updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fail_htlc(node_b_id, &bs_fail_updates.update_fail_htlcs[0]);
let commitment = &bs_fail_updates.commitment_signed;
do_commitment_signed_dance(&nodes[0], &nodes[1], commitment, false, true);
@@ -701,7 +701,7 @@ pub fn holding_cell_htlc_counting() {
let (bs_revoke_and_ack, bs_commitment_signed) = get_revoke_commit_msgs(&nodes[2], &node_b_id);
nodes[1].node.handle_revoke_and_ack(node_c_id, &bs_revoke_and_ack);
check_added_monitors(&nodes[1], 1);
- let as_updates = get_htlc_update_msgs!(nodes[1], node_c_id);
+ let as_updates = get_htlc_update_msgs(&nodes[1], &node_c_id);
nodes[1].node.handle_commitment_signed_batch_test(node_c_id, &bs_commitment_signed);
check_added_monitors(&nodes[1], 1);
@@ -1381,7 +1381,7 @@ pub fn test_update_add_htlc_bolt2_receiver_zero_value_msat() {
let id = PaymentId(our_payment_hash.0);
nodes[0].node.send_payment_with_route(route, our_payment_hash, onion, id).unwrap();
check_added_monitors(&nodes[0], 1);
- let mut updates = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let mut updates = get_htlc_update_msgs(&nodes[0], &node_b_id);
updates.update_add_htlcs[0].amount_msat = 0;
nodes[1].node.handle_update_add_htlc(node_a_id, &updates.update_add_htlcs[0]);
@@ -1543,7 +1543,7 @@ pub fn test_update_add_htlc_bolt2_receiver_check_amount_received_more_than_min()
let id = PaymentId(our_payment_hash.0);
nodes[0].node.send_payment_with_route(route, our_payment_hash, onion, id).unwrap();
check_added_monitors(&nodes[0], 1);
- let mut updates = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let mut updates = get_htlc_update_msgs(&nodes[0], &node_b_id);
updates.update_add_htlcs[0].amount_msat = htlc_minimum_msat - 1;
nodes[1].node.handle_update_add_htlc(node_a_id, &updates.update_add_htlcs[0]);
assert!(nodes[1].node.list_channels().is_empty());
@@ -1581,7 +1581,7 @@ pub fn test_update_add_htlc_bolt2_receiver_sender_can_afford_amount_sent() {
let id = PaymentId(our_payment_hash.0);
nodes[0].node.send_payment_with_route(route, our_payment_hash, onion, id).unwrap();
check_added_monitors(&nodes[0], 1);
- let mut updates = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let mut updates = get_htlc_update_msgs(&nodes[0], &node_b_id);
// Even though channel-initiator senders are required to respect the fee_spike_reserve,
// at this time channel-initiatee receivers are not required to enforce that senders
@@ -1684,7 +1684,7 @@ pub fn test_update_add_htlc_bolt2_receiver_check_max_in_flight_msat() {
let id = PaymentId(our_payment_hash.0);
nodes[0].node.send_payment_with_route(route, our_payment_hash, onion, id).unwrap();
check_added_monitors(&nodes[0], 1);
- let mut updates = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let mut updates = get_htlc_update_msgs(&nodes[0], &node_b_id);
updates.update_add_htlcs[0].amount_msat = get_channel_value_stat!(nodes[1], nodes[0], chan.2)
.counterparty_max_htlc_value_in_flight_msat
+ 1;
@@ -1718,7 +1718,7 @@ pub fn test_update_add_htlc_bolt2_receiver_check_cltv_expiry() {
let id = PaymentId(our_payment_hash.0);
nodes[0].node.send_payment_with_route(route, our_payment_hash, reason, id).unwrap();
check_added_monitors(&nodes[0], 1);
- let mut updates = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let mut updates = get_htlc_update_msgs(&nodes[0], &node_b_id);
updates.update_add_htlcs[0].cltv_expiry = 500000000;
nodes[1].node.handle_update_add_htlc(node_a_id, &updates.update_add_htlcs[0]);
@@ -1751,7 +1751,7 @@ pub fn test_update_add_htlc_bolt2_receiver_check_repeated_id_ignore() {
nodes[0].node.send_payment_with_route(route, our_payment_hash, onion, id).unwrap();
check_added_monitors(&nodes[0], 1);
- let updates = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let updates = get_htlc_update_msgs(&nodes[0], &node_b_id);
nodes[1].node.handle_update_add_htlc(node_a_id, &updates.update_add_htlcs[0]);
//Disconnect and Reconnect
@@ -1816,7 +1816,7 @@ pub fn test_update_fulfill_htlc_bolt2_update_fulfill_htlc_before_commitment() {
nodes[0].node.send_payment_with_route(route, our_payment_hash, onion, id).unwrap();
check_added_monitors(&nodes[0], 1);
- let updates = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let updates = get_htlc_update_msgs(&nodes[0], &node_b_id);
nodes[1].node.handle_update_add_htlc(node_a_id, &updates.update_add_htlcs[0]);
let update_msg = msgs::UpdateFulfillHTLC {
@@ -1860,7 +1860,7 @@ pub fn test_update_fulfill_htlc_bolt2_update_fail_htlc_before_commitment() {
let id = PaymentId(our_payment_hash.0);
nodes[0].node.send_payment_with_route(route, our_payment_hash, onion, id).unwrap();
check_added_monitors(&nodes[0], 1);
- let updates = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let updates = get_htlc_update_msgs(&nodes[0], &node_b_id);
nodes[1].node.handle_update_add_htlc(node_a_id, &updates.update_add_htlcs[0]);
let update_msg = msgs::UpdateFailHTLC {
@@ -1904,7 +1904,7 @@ pub fn test_update_fulfill_htlc_bolt2_update_fail_malformed_htlc_before_commitme
let id = PaymentId(our_payment_hash.0);
nodes[0].node.send_payment_with_route(route, our_payment_hash, onion, id).unwrap();
check_added_monitors(&nodes[0], 1);
- let updates = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let updates = get_htlc_update_msgs(&nodes[0], &node_b_id);
nodes[1].node.handle_update_add_htlc(node_a_id, &updates.update_add_htlcs[0]);
let update_msg = msgs::UpdateFailMalformedHTLC {
channel_id: chan.2,
@@ -2068,7 +2068,7 @@ pub fn test_update_fulfill_htlc_bolt2_missing_badonion_bit_for_malformed_htlc_me
nodes[0].node.send_payment_with_route(route, our_payment_hash, onion, id).unwrap();
check_added_monitors(&nodes[0], 1);
- let mut updates = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let mut updates = get_htlc_update_msgs(&nodes[0], &node_b_id);
updates.update_add_htlcs[0].onion_routing_packet.version = 1; //Produce a malformed HTLC message
nodes[1].node.handle_update_add_htlc(node_a_id, &updates.update_add_htlcs[0]);
diff --git a/lightning/src/ln/monitor_tests.rs b/lightning/src/ln/monitor_tests.rs
index db310f5..ba80dbf 100644
--- a/lightning/src/ln/monitor_tests.rs
+++ b/lightning/src/ln/monitor_tests.rs
@@ -72,12 +72,12 @@ fn chanmon_fail_from_stale_commitment() {
let bs_txn = get_local_commitment_txn!(nodes[1], chan_id_2);
- let updates = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
+ let updates = get_htlc_update_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
nodes[1].node.handle_update_add_htlc(nodes[0].node.get_our_node_id(), &updates.update_add_htlcs[0]);
do_commitment_signed_dance(&nodes[1], &nodes[0], &updates.commitment_signed, false, false);
expect_and_process_pending_htlcs(&nodes[1], false);
- get_htlc_update_msgs!(nodes[1], nodes[2].node.get_our_node_id());
+ get_htlc_update_msgs(&nodes[1], &nodes[2].node.get_our_node_id());
check_added_monitors!(nodes[1], 1);
// Don't bother delivering the new HTLC add/commits, instead confirming the pre-HTLC commitment
@@ -91,7 +91,7 @@ fn chanmon_fail_from_stale_commitment() {
connect_blocks(&nodes[1], ANTI_REORG_DELAY - 1);
expect_and_process_pending_htlcs_and_htlc_handling_failed(&nodes[1], &[HTLCHandlingFailureType::Forward { node_id: Some(nodes[2].node.get_our_node_id()), channel_id: chan_id_2 }]);
check_added_monitors!(nodes[1], 1);
- let fail_updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let fail_updates = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
nodes[0].node.handle_update_fail_htlc(nodes[1].node.get_our_node_id(), &fail_updates.update_fail_htlcs[0]);
do_commitment_signed_dance(&nodes[0], &nodes[1], &fail_updates.commitment_signed, true, true);
@@ -568,7 +568,7 @@ fn do_test_claim_value_force_close(keyed_anchors: bool, p2a_anchor: bool, prev_c
check_added_monitors!(nodes[1], 1);
expect_payment_claimed!(nodes[1], payment_hash, 3_000_100);
- let mut b_htlc_msgs = get_htlc_update_msgs!(&nodes[1], nodes[0].node.get_our_node_id());
+ let mut b_htlc_msgs = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
// We claim the dust payment here as well, but it won't impact our claimable balances as its
// dust and thus doesn't appear on chain at all.
nodes[1].node.claim_funds(dust_payment_preimage);
@@ -588,7 +588,7 @@ fn do_test_claim_value_force_close(keyed_anchors: bool, p2a_anchor: bool, prev_c
check_added_monitors!(nodes[0], 1);
let (as_raa, as_cs) = get_revoke_commit_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
nodes[1].node.handle_revoke_and_ack(nodes[0].node.get_our_node_id(), &as_raa);
- let _htlc_updates = get_htlc_update_msgs!(&nodes[1], nodes[0].node.get_our_node_id());
+ let _htlc_updates = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
check_added_monitors!(nodes[1], 1);
nodes[1].node.handle_commitment_signed_batch_test(nodes[0].node.get_our_node_id(), &as_cs);
let _bs_raa = get_event_msg!(nodes[1], MessageSendEvent::SendRevokeAndACK, nodes[0].node.get_our_node_id());
@@ -887,7 +887,7 @@ fn do_test_balances_on_local_commitment_htlcs(keyed_anchors: bool, p2a_anchor: b
RecipientOnionFields::secret_only(payment_secret), PaymentId(payment_hash.0)).unwrap();
check_added_monitors!(nodes[0], 1);
- let updates = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
+ let updates = get_htlc_update_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
nodes[1].node.handle_update_add_htlc(nodes[0].node.get_our_node_id(), &updates.update_add_htlcs[0]);
do_commitment_signed_dance(&nodes[1], &nodes[0], &updates.commitment_signed, false, false);
@@ -899,14 +899,14 @@ fn do_test_balances_on_local_commitment_htlcs(keyed_anchors: bool, p2a_anchor: b
RecipientOnionFields::secret_only(payment_secret_2), PaymentId(payment_hash_2.0)).unwrap();
check_added_monitors!(nodes[0], 1);
- let updates = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
+ let updates = get_htlc_update_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
nodes[1].node.handle_update_add_htlc(nodes[0].node.get_our_node_id(), &updates.update_add_htlcs[0]);
do_commitment_signed_dance(&nodes[1], &nodes[0], &updates.commitment_signed, false, false);
expect_and_process_pending_htlcs(&nodes[1], false);
expect_payment_claimable!(nodes[1], payment_hash_2, payment_secret_2, 20_000_000);
nodes[1].node.claim_funds(payment_preimage_2);
- get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
check_added_monitors!(nodes[1], 1);
expect_payment_claimed!(nodes[1], payment_hash_2, 20_000_000);
@@ -1428,7 +1428,7 @@ fn do_test_revoked_counterparty_commitment_balances(keyed_anchors: bool, p2a_anc
nodes[1].node.claim_funds(claimed_payment_preimage);
expect_payment_claimed!(nodes[1], claimed_payment_hash, 3_000_100);
check_added_monitors!(nodes[1], 1);
- let _b_htlc_msgs = get_htlc_update_msgs!(&nodes[1], nodes[0].node.get_our_node_id());
+ let _b_htlc_msgs = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
connect_blocks(&nodes[0], htlc_cltv_timeout + 1 - 10);
check_closed_broadcast!(nodes[0], true);
@@ -2021,7 +2021,7 @@ fn do_test_revoked_counterparty_aggregated_claims(keyed_anchors: bool, p2a_ancho
nodes[0].node.claim_funds(claimed_payment_preimage);
expect_payment_claimed!(nodes[0], claimed_payment_hash, 3_000_100);
check_added_monitors!(nodes[0], 1);
- let _a_htlc_msgs = get_htlc_update_msgs!(&nodes[0], nodes[1].node.get_our_node_id());
+ let _a_htlc_msgs = get_htlc_update_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
assert_eq!(sorted_vec(vec![Balance::ClaimableOnChannelClose {
balance_candidates: vec![HolderCommitmentTransactionBalance {
diff --git a/lightning/src/ln/offers_tests.rs b/lightning/src/ln/offers_tests.rs
index 3a6965c..fc11843 100644
--- a/lightning/src/ln/offers_tests.rs
+++ b/lightning/src/ln/offers_tests.rs
@@ -2424,7 +2424,7 @@ fn rejects_keysend_to_non_static_invoice_path() {
.with_payment_preimage(payment_preimage)
.expect_failure(HTLCHandlingFailureType::Receive { payment_hash });
do_pass_along_path(args);
- let mut updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let mut updates = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
nodes[0].node.handle_update_fail_htlc(nodes[1].node.get_our_node_id(), &updates.update_fail_htlcs[0]);
do_commitment_signed_dance(&nodes[0], &nodes[1], &updates.commitment_signed, false, false);
expect_payment_failed_conditions(&nodes[0], payment_hash, true, PaymentFailedConditions::new());
diff --git a/lightning/src/ln/onion_route_tests.rs b/lightning/src/ln/onion_route_tests.rs
index 0581e4d..3c764a0 100644
--- a/lightning/src/ln/onion_route_tests.rs
+++ b/lightning/src/ln/onion_route_tests.rs
@@ -134,7 +134,7 @@ fn run_onion_failure_test_with_fail_intercept<F1, F2, F3>(
.send_payment_with_route(route.clone(), *payment_hash, recipient_onion, payment_id)
.unwrap();
check_added_monitors!(nodes[0], 1);
- let update_0 = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
+ let update_0 = get_htlc_update_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
// temper update_add (0 => 1)
let mut update_add_0 = update_0.update_add_htlcs[0].clone();
if test_case == 0 || test_case == 3 || test_case == 100 {
@@ -154,7 +154,7 @@ fn run_onion_failure_test_with_fail_intercept<F1, F2, F3>(
&[expected_failure_type.clone().unwrap()]
);
check_added_monitors(&nodes[1], 1);
- let update_1_0 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let update_1_0 = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
let fail_len = update_1_0.update_fail_htlcs.len();
let malformed_len = update_1_0.update_fail_malformed_htlcs.len();
assert!(fail_len + malformed_len == 1);
@@ -169,7 +169,7 @@ fn run_onion_failure_test_with_fail_intercept<F1, F2, F3>(
}
expect_htlc_forward!(&nodes[1]);
- let update_1 = get_htlc_update_msgs!(nodes[1], nodes[2].node.get_our_node_id());
+ let update_1 = get_htlc_update_msgs(&nodes[1], &nodes[2].node.get_our_node_id());
check_added_monitors!(&nodes[1], 1);
assert_eq!(update_1.update_add_htlcs.len(), 1);
// tamper update_add (1 => 2)
@@ -204,7 +204,7 @@ fn run_onion_failure_test_with_fail_intercept<F1, F2, F3>(
}
check_added_monitors!(&nodes[2], 1);
- let update_2_1 = get_htlc_update_msgs!(nodes[2], nodes[1].node.get_our_node_id());
+ let update_2_1 = get_htlc_update_msgs(&nodes[2], &nodes[1].node.get_our_node_id());
assert!(update_2_1.update_fail_htlcs.len() == 1);
let mut fail_msg = update_2_1.update_fail_htlcs[0].clone();
@@ -224,7 +224,7 @@ fn run_onion_failure_test_with_fail_intercept<F1, F2, F3>(
do_commitment_signed_dance(&nodes[1], &nodes[2], commitment, true, false);
// backward fail on 1
- let update_1_0 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let update_1_0 = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
assert!(update_1_0.update_fail_htlcs.len() == 1);
update_1_0
},
@@ -1549,7 +1549,7 @@ fn test_overshoot_final_cltv() {
.unwrap();
check_added_monitors!(nodes[0], 1);
- let update_0 = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
+ let update_0 = get_htlc_update_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
let mut update_add_0 = update_0.update_add_htlcs[0].clone();
nodes[1].node.handle_update_add_htlc(nodes[0].node.get_our_node_id(), &update_add_0);
do_commitment_signed_dance(&nodes[1], &nodes[0], &update_0.commitment_signed, false, true);
@@ -1568,7 +1568,7 @@ fn test_overshoot_final_cltv() {
expect_and_process_pending_htlcs(&nodes[1], false);
check_added_monitors!(&nodes[1], 1);
- let update_1 = get_htlc_update_msgs!(nodes[1], nodes[2].node.get_our_node_id());
+ let update_1 = get_htlc_update_msgs(&nodes[1], &nodes[2].node.get_our_node_id());
let mut update_add_1 = update_1.update_add_htlcs[0].clone();
nodes[2].node.handle_update_add_htlc(nodes[1].node.get_our_node_id(), &update_add_1);
do_commitment_signed_dance(&nodes[2], &nodes[1], &update_1.commitment_signed, false, true);
@@ -2436,7 +2436,7 @@ fn test_phantom_onion_hmac_failure() {
.send_payment_with_route(route, payment_hash, recipient_onion, PaymentId(payment_hash.0))
.unwrap();
check_added_monitors!(nodes[0], 1);
- let update_0 = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
+ let update_0 = get_htlc_update_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
let mut update_add = update_0.update_add_htlcs[0].clone();
nodes[1].node.handle_update_add_htlc(nodes[0].node.get_our_node_id(), &update_add);
@@ -2469,7 +2469,7 @@ fn test_phantom_onion_hmac_failure() {
&[HTLCHandlingFailureType::Receive { payment_hash }],
);
nodes[1].node.process_pending_htlc_forwards();
- let update_1 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let update_1 = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
check_added_monitors!(&nodes[1], 1);
assert!(update_1.update_fail_htlcs.len() == 1);
let fail_msg = update_1.update_fail_htlcs[0].clone();
@@ -2509,7 +2509,7 @@ fn test_phantom_invalid_onion_payload() {
.send_payment_with_route(route.clone(), payment_hash, recipient_onion, payment_id)
.unwrap();
check_added_monitors!(nodes[0], 1);
- let update_0 = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
+ let update_0 = get_htlc_update_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
let mut update_add = update_0.update_add_htlcs[0].clone();
nodes[1].node.handle_update_add_htlc(nodes[0].node.get_our_node_id(), &update_add);
@@ -2570,7 +2570,7 @@ fn test_phantom_invalid_onion_payload() {
&[HTLCHandlingFailureType::Receive { payment_hash }],
);
nodes[1].node.process_pending_htlc_forwards();
- let update_1 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let update_1 = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
check_added_monitors!(&nodes[1], 1);
assert!(update_1.update_fail_htlcs.len() == 1);
let fail_msg = update_1.update_fail_htlcs[0].clone();
@@ -2608,7 +2608,7 @@ fn test_phantom_final_incorrect_cltv_expiry() {
.send_payment_with_route(route, payment_hash, recipient_onion, PaymentId(payment_hash.0))
.unwrap();
check_added_monitors!(nodes[0], 1);
- let update_0 = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
+ let update_0 = get_htlc_update_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
let mut update_add = update_0.update_add_htlcs[0].clone();
nodes[1].node.handle_update_add_htlc(nodes[0].node.get_our_node_id(), &update_add);
@@ -2636,7 +2636,7 @@ fn test_phantom_final_incorrect_cltv_expiry() {
&[HTLCHandlingFailureType::Receive { payment_hash }],
);
nodes[1].node.process_pending_htlc_forwards();
- let update_1 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let update_1 = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
check_added_monitors!(&nodes[1], 1);
assert!(update_1.update_fail_htlcs.len() == 1);
let fail_msg = update_1.update_fail_htlcs[0].clone();
@@ -2677,7 +2677,7 @@ fn test_phantom_failure_too_low_cltv() {
.send_payment_with_route(route, payment_hash, recipient_onion, PaymentId(payment_hash.0))
.unwrap();
check_added_monitors!(nodes[0], 1);
- let update_0 = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
+ let update_0 = get_htlc_update_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
let mut update_add = update_0.update_add_htlcs[0].clone();
nodes[1].node.handle_update_add_htlc(nodes[0].node.get_our_node_id(), &update_add);
@@ -2690,7 +2690,7 @@ fn test_phantom_failure_too_low_cltv() {
&[HTLCHandlingFailureType::Receive { payment_hash }],
);
nodes[1].node.process_pending_htlc_forwards();
- let update_1 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let update_1 = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
check_added_monitors!(&nodes[1], 1);
assert!(update_1.update_fail_htlcs.len() == 1);
let fail_msg = update_1.update_fail_htlcs[0].clone();
@@ -2730,7 +2730,7 @@ fn test_phantom_failure_modified_cltv() {
.send_payment_with_route(route, payment_hash, recipient_onion, PaymentId(payment_hash.0))
.unwrap();
check_added_monitors!(nodes[0], 1);
- let update_0 = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
+ let update_0 = get_htlc_update_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
let mut update_add = update_0.update_add_htlcs[0].clone();
// Modify the route to have a too-low cltv.
@@ -2745,7 +2745,7 @@ fn test_phantom_failure_modified_cltv() {
);
check_added_monitors(&nodes[1], 1);
- let update_1 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let update_1 = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
assert!(update_1.update_fail_htlcs.len() == 1);
let fail_msg = update_1.update_fail_htlcs[0].clone();
nodes[0].node.handle_update_fail_htlc(nodes[1].node.get_our_node_id(), &fail_msg);
@@ -2785,7 +2785,7 @@ fn test_phantom_failure_expires_too_soon() {
.send_payment_with_route(route, payment_hash, recipient_onion, PaymentId(payment_hash.0))
.unwrap();
check_added_monitors!(nodes[0], 1);
- let update_0 = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
+ let update_0 = get_htlc_update_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
let mut update_add = update_0.update_add_htlcs[0].clone();
connect_blocks(&nodes[1], CLTV_FAR_FAR_AWAY);
@@ -2798,7 +2798,7 @@ fn test_phantom_failure_expires_too_soon() {
);
check_added_monitors(&nodes[1], 1);
- let update_1 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let update_1 = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
assert!(update_1.update_fail_htlcs.len() == 1);
let fail_msg = update_1.update_fail_htlcs[0].clone();
nodes[0].node.handle_update_fail_htlc(nodes[1].node.get_our_node_id(), &fail_msg);
@@ -2835,7 +2835,7 @@ fn test_phantom_failure_too_low_recv_amt() {
.send_payment_with_route(route, payment_hash, recipient_onion, PaymentId(payment_hash.0))
.unwrap();
check_added_monitors!(nodes[0], 1);
- let update_0 = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
+ let update_0 = get_htlc_update_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
let mut update_add = update_0.update_add_htlcs[0].clone();
nodes[1].node.handle_update_add_htlc(nodes[0].node.get_our_node_id(), &update_add);
@@ -2850,7 +2850,7 @@ fn test_phantom_failure_too_low_recv_amt() {
&[HTLCHandlingFailureType::Receive { payment_hash: payment_hash.clone() }],
);
nodes[1].node.process_pending_htlc_forwards();
- let update_1 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let update_1 = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
check_added_monitors!(&nodes[1], 1);
assert!(update_1.update_fail_htlcs.len() == 1);
let fail_msg = update_1.update_fail_htlcs[0].clone();
@@ -2905,7 +2905,7 @@ fn do_test_phantom_dust_exposure_failure(multiplier_dust_limit: bool) {
.send_payment_with_route(route.clone(), payment_hash, recipient_onion, payment_id)
.unwrap();
check_added_monitors!(nodes[0], 1);
- let update_0 = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
+ let update_0 = get_htlc_update_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
let mut update_add = update_0.update_add_htlcs[0].clone();
nodes[1].node.handle_update_add_htlc(nodes[0].node.get_our_node_id(), &update_add);
@@ -2917,7 +2917,7 @@ fn do_test_phantom_dust_exposure_failure(multiplier_dust_limit: bool) {
);
check_added_monitors(&nodes[1], 1);
- let update_1 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let update_1 = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
assert!(update_1.update_fail_htlcs.len() == 1);
let fail_msg = update_1.update_fail_htlcs[0].clone();
nodes[0].node.handle_update_fail_htlc(nodes[1].node.get_our_node_id(), &fail_msg);
@@ -2955,7 +2955,7 @@ fn test_phantom_failure_reject_payment() {
.send_payment_with_route(route.clone(), payment_hash, recipient_onion, payment_id)
.unwrap();
check_added_monitors!(nodes[0], 1);
- let update_0 = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
+ let update_0 = get_htlc_update_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
let mut update_add = update_0.update_add_htlcs[0].clone();
nodes[1].node.handle_update_add_htlc(nodes[0].node.get_our_node_id(), &update_add);
@@ -2980,7 +2980,7 @@ fn test_phantom_failure_reject_payment() {
);
nodes[1].node.process_pending_htlc_forwards();
- let update_1 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let update_1 = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
check_added_monitors!(&nodes[1], 1);
assert!(update_1.update_fail_htlcs.len() == 1);
let fail_msg = update_1.update_fail_htlcs[0].clone();
diff --git a/lightning/src/ln/payment_tests.rs b/lightning/src/ln/payment_tests.rs
index ac26f79..b848827 100644
--- a/lightning/src/ln/payment_tests.rs
+++ b/lightning/src/ln/payment_tests.rs
@@ -164,7 +164,7 @@ fn mpp_retry() {
let events = nodes[2].node.get_and_clear_pending_events();
let fail = HTLCHandlingFailureType::Forward { node_id: Some(node_d_id), channel_id: chan_4_id };
expect_htlc_failure_conditions(events, &[fail]);
- let htlc_updates = get_htlc_update_msgs!(nodes[2], node_a_id);
+ let htlc_updates = get_htlc_update_msgs(&nodes[2], &node_a_id);
assert!(htlc_updates.update_add_htlcs.is_empty());
assert_eq!(htlc_updates.update_fail_htlcs.len(), 1);
assert!(htlc_updates.update_fulfill_htlcs.is_empty());
@@ -283,7 +283,7 @@ fn mpp_retry_overpay() {
let fail = HTLCHandlingFailureType::Forward { node_id: Some(node_d_id), channel_id: chan_4_id };
expect_htlc_failure_conditions(events, &[fail]);
- let htlc_updates = get_htlc_update_msgs!(nodes[2], node_a_id);
+ let htlc_updates = get_htlc_update_msgs(&nodes[2], &node_a_id);
assert!(htlc_updates.update_add_htlcs.is_empty());
assert_eq!(htlc_updates.update_fail_htlcs.len(), 1);
assert!(htlc_updates.update_fulfill_htlcs.is_empty());
@@ -381,7 +381,7 @@ fn do_mpp_receive_timeout(send_partial_mpp: bool) {
let fail = HTLCHandlingFailureType::Receive { payment_hash: hash };
expect_and_process_pending_htlcs_and_htlc_handling_failed(&nodes[3], &[fail]);
- let htlc_fail_updates = get_htlc_update_msgs!(nodes[3], node_b_id);
+ let htlc_fail_updates = get_htlc_update_msgs(&nodes[3], &node_b_id);
assert_eq!(htlc_fail_updates.update_fail_htlcs.len(), 1);
nodes[1].node.handle_update_fail_htlc(node_d_id, &htlc_fail_updates.update_fail_htlcs[0]);
check_added_monitors!(nodes[3], 1);
@@ -394,7 +394,7 @@ fn do_mpp_receive_timeout(send_partial_mpp: bool) {
HTLCHandlingFailureType::Forward { node_id: Some(node_d_id), channel_id: chan_3_id };
expect_and_process_pending_htlcs_and_htlc_handling_failed(&nodes[1], &[fail_type]);
- let htlc_fail_updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let htlc_fail_updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert_eq!(htlc_fail_updates.update_fail_htlcs.len(), 1);
nodes[0].node.handle_update_fail_htlc(node_b_id, &htlc_fail_updates.update_fail_htlcs[0]);
check_added_monitors!(nodes[1], 1);
@@ -623,14 +623,14 @@ fn test_reject_mpp_keysend_htlc_mismatching_secret() {
nodes[0].node.send_spontaneous_payment(preimage, onion, payment_id_0, params, retry).unwrap();
check_added_monitors!(nodes[0], 1);
- let update_0 = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let update_0 = get_htlc_update_msgs(&nodes[0], &node_b_id);
let update_add_0 = update_0.update_add_htlcs[0].clone();
nodes[1].node.handle_update_add_htlc(node_a_id, &update_add_0);
do_commitment_signed_dance(&nodes[1], &nodes[0], &update_0.commitment_signed, false, true);
expect_and_process_pending_htlcs(&nodes[1], false);
check_added_monitors!(&nodes[1], 1);
- let update_1 = get_htlc_update_msgs!(nodes[1], node_d_id);
+ let update_1 = get_htlc_update_msgs(&nodes[1], &node_d_id);
let update_add_1 = update_1.update_add_htlcs[0].clone();
nodes[3].node.handle_update_add_htlc(node_b_id, &update_add_1);
do_commitment_signed_dance(&nodes[3], &nodes[1], &update_1.commitment_signed, false, true);
@@ -672,14 +672,14 @@ fn test_reject_mpp_keysend_htlc_mismatching_secret() {
nodes[0].node.send_spontaneous_payment(preimage, onion, payment_id_1, params, retry).unwrap();
check_added_monitors!(nodes[0], 1);
- let update_2 = get_htlc_update_msgs!(nodes[0], node_c_id);
+ let update_2 = get_htlc_update_msgs(&nodes[0], &node_c_id);
let update_add_2 = update_2.update_add_htlcs[0].clone();
nodes[2].node.handle_update_add_htlc(node_a_id, &update_add_2);
do_commitment_signed_dance(&nodes[2], &nodes[0], &update_2.commitment_signed, false, true);
expect_and_process_pending_htlcs(&nodes[2], false);
check_added_monitors!(&nodes[2], 1);
- let update_3 = get_htlc_update_msgs!(nodes[2], node_d_id);
+ let update_3 = get_htlc_update_msgs(&nodes[2], &node_d_id);
let update_add_3 = update_3.update_add_htlcs[0].clone();
nodes[3].node.handle_update_add_htlc(node_c_id, &update_add_3);
do_commitment_signed_dance(&nodes[3], &nodes[2], &update_3.commitment_signed, false, true);
@@ -713,7 +713,7 @@ fn test_reject_mpp_keysend_htlc_mismatching_secret() {
check_added_monitors!(nodes[3], 1);
// Fail back along nodes[2]
- let update_fail_0 = get_htlc_update_msgs!(&nodes[3], &node_c_id);
+ let update_fail_0 = get_htlc_update_msgs(&nodes[3], &node_c_id);
nodes[2].node.handle_update_fail_htlc(node_d_id, &update_fail_0.update_fail_htlcs[0]);
let commitment = &update_fail_0.commitment_signed;
do_commitment_signed_dance(&nodes[2], &nodes[3], commitment, false, false);
@@ -723,7 +723,7 @@ fn test_reject_mpp_keysend_htlc_mismatching_secret() {
expect_and_process_pending_htlcs_and_htlc_handling_failed(&nodes[2], &[fail_type]);
check_added_monitors!(nodes[2], 1);
- let update_fail_1 = get_htlc_update_msgs!(nodes[2], node_a_id);
+ let update_fail_1 = get_htlc_update_msgs(&nodes[2], &node_a_id);
nodes[0].node.handle_update_fail_htlc(node_c_id, &update_fail_1.update_fail_htlcs[0]);
let commitment = &update_fail_1.commitment_signed;
do_commitment_signed_dance(&nodes[0], &nodes[2], commitment, false, false);
@@ -830,7 +830,7 @@ fn do_retry_with_no_persist(confirm_before_reload: bool) {
check_added_monitors(&nodes[1], 1);
// nodes[1] now immediately fails the HTLC as the next-hop channel is disconnected
- let _ = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let _ = get_htlc_update_msgs(&nodes[1], &node_a_id);
reconnect_nodes(ReconnectArgs::new(&nodes[1], &nodes[2]));
@@ -903,7 +903,7 @@ fn do_retry_with_no_persist(confirm_before_reload: bool) {
check_added_monitors!(nodes[2], 1);
expect_payment_claimed!(nodes[2], payment_hash_1, 1_000_000);
- let mut htlc_fulfill = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let mut htlc_fulfill = get_htlc_update_msgs(&nodes[2], &node_b_id);
let fulfill_msg = htlc_fulfill.update_fulfill_htlcs.remove(0);
nodes[1].node.handle_update_fulfill_htlc(node_c_id, fulfill_msg);
check_added_monitors!(nodes[1], 1);
@@ -1116,7 +1116,7 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) {
expect_and_process_pending_htlcs_and_htlc_handling_failed(&nodes[2], &[fail_type]);
check_added_monitors!(nodes[2], 1);
- let htlc_fulfill_updates = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let htlc_fulfill_updates = get_htlc_update_msgs(&nodes[2], &node_b_id);
nodes[1].node.handle_update_fail_htlc(node_c_id, &htlc_fulfill_updates.update_fail_htlcs[0]);
let commitment = &htlc_fulfill_updates.commitment_signed;
do_commitment_signed_dance(&nodes[1], &nodes[2], commitment, false, false);
@@ -1451,7 +1451,7 @@ fn test_fulfill_restart_failure() {
check_added_monitors!(nodes[1], 1);
expect_payment_claimed!(nodes[1], payment_hash, 100_000);
- let mut htlc_fulfill = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut htlc_fulfill = get_htlc_update_msgs(&nodes[1], &node_a_id);
let fulfill_msg = htlc_fulfill.update_fulfill_htlcs.remove(0);
nodes[0].node.handle_update_fulfill_htlc(node_b_id, fulfill_msg);
expect_payment_sent(&nodes[0], payment_preimage, None, false, false);
@@ -1467,7 +1467,7 @@ fn test_fulfill_restart_failure() {
expect_and_process_pending_htlcs_and_htlc_handling_failed(&nodes[1], &[fail_type]);
check_added_monitors!(nodes[1], 1);
- let htlc_fail_updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let htlc_fail_updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fail_htlc(node_b_id, &htlc_fail_updates.update_fail_htlcs[0]);
let commitment = &htlc_fail_updates.commitment_signed;
do_commitment_signed_dance(&nodes[0], &nodes[1], commitment, false, false);
@@ -1557,7 +1557,7 @@ fn sent_probe_is_probe_of_sending_node() {
_ => panic!(),
}
- get_htlc_update_msgs!(nodes[0], node_b_id);
+ get_htlc_update_msgs(&nodes[0], &node_b_id);
check_added_monitors!(nodes[0], 1);
}
@@ -1606,7 +1606,7 @@ fn failed_probe_yields_event() {
// node[0] -- update_add_htlcs -> node[1]
check_added_monitors!(nodes[0], 1);
- let updates = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let updates = get_htlc_update_msgs(&nodes[0], &node_b_id);
let probe_event = SendEvent::from_commitment_update(node_b_id, channel_id, updates);
nodes[1].node.handle_update_add_htlc(node_a_id, &probe_event.msgs[0]);
check_added_monitors!(nodes[1], 0);
@@ -1615,7 +1615,7 @@ fn failed_probe_yields_event() {
// node[0] <- update_fail_htlcs -- node[1]
check_added_monitors!(nodes[1], 1);
- let updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
let _events = nodes[1].node.get_and_clear_pending_events();
nodes[0].node.handle_update_fail_htlc(node_b_id, &updates.update_fail_htlcs[0]);
check_added_monitors!(nodes[0], 0);
@@ -1657,7 +1657,7 @@ fn onchain_failed_probe_yields_event() {
// node[0] -- update_add_htlcs -> node[1]
check_added_monitors!(nodes[0], 1);
- let updates = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let updates = get_htlc_update_msgs(&nodes[0], &node_b_id);
let probe_event = SendEvent::from_commitment_update(node_b_id, chan_id, updates);
nodes[1].node.handle_update_add_htlc(node_a_id, &probe_event.msgs[0]);
check_added_monitors!(nodes[1], 0);
@@ -1665,7 +1665,7 @@ fn onchain_failed_probe_yields_event() {
expect_and_process_pending_htlcs(&nodes[1], false);
check_added_monitors!(nodes[1], 1);
- let _ = get_htlc_update_msgs!(nodes[1], node_c_id);
+ let _ = get_htlc_update_msgs(&nodes[1], &node_c_id);
// Don't bother forwarding the HTLC onwards and just confirm the force-close transaction on
// Node A, which after 6 confirmations should result in a probe failure event.
@@ -2307,7 +2307,7 @@ fn do_test_intercepted_payment(test: InterceptTest) {
HTLCHandlingFailureType::InvalidForward { requested_forward_scid: intercept_scid };
expect_htlc_failure_conditions(nodes[1].node.get_and_clear_pending_events(), &[fail]);
nodes[1].node.process_pending_htlc_forwards();
- let update_fail = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let update_fail = get_htlc_update_msgs(&nodes[1], &node_a_id);
check_added_monitors!(&nodes[1], 1);
assert!(update_fail.update_fail_htlcs.len() == 1);
let fail_msg = update_fail.update_fail_htlcs[0].clone();
@@ -2395,7 +2395,7 @@ fn do_test_intercepted_payment(test: InterceptTest) {
expect_and_process_pending_htlcs_and_htlc_handling_failed(&nodes[1], &[fail_type]);
check_added_monitors!(nodes[1], 1);
- let htlc_fail = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let htlc_fail = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert!(htlc_fail.update_add_htlcs.is_empty());
assert_eq!(htlc_fail.update_fail_htlcs.len(), 1);
assert!(htlc_fail.update_fail_malformed_htlcs.is_empty());
@@ -2647,7 +2647,7 @@ fn do_automatic_retries(test: AutoRetry) {
($failing_channel_id: expr, $expect_pending_htlcs_forwardable: expr) => {
// Send a payment attempt that fails due to lack of liquidity on the second hop
check_added_monitors!(nodes[0], 1);
- let update_0 = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let update_0 = get_htlc_update_msgs(&nodes[0], &node_b_id);
let mut update_add = update_0.update_add_htlcs[0].clone();
nodes[1].node.handle_update_add_htlc(node_a_id, &update_add);
let commitment = &update_0.commitment_signed;
@@ -2662,7 +2662,7 @@ fn do_automatic_retries(test: AutoRetry) {
}],
);
nodes[1].node.process_pending_htlc_forwards();
- let update_1 = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let update_1 = get_htlc_update_msgs(&nodes[1], &node_a_id);
check_added_monitors!(&nodes[1], 1);
assert!(update_1.update_fail_htlcs.len() == 1);
let fail_msg = update_1.update_fail_htlcs[0].clone();
@@ -3051,7 +3051,7 @@ fn auto_retry_partial_failure() {
expect_payment_claimable!(nodes[1], payment_hash, payment_secret, amt_msat);
nodes[1].node.claim_funds(payment_preimage);
expect_payment_claimed!(nodes[1], payment_hash, amt_msat);
- let mut bs_claim = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut bs_claim = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert_eq!(bs_claim.update_fulfill_htlcs.len(), 1);
nodes[0].node.handle_update_fulfill_htlc(node_b_id, bs_claim.update_fulfill_htlcs.remove(0));
@@ -3062,7 +3062,7 @@ fn auto_retry_partial_failure() {
nodes[1].node.handle_revoke_and_ack(node_a_id, &as_third_raa);
check_added_monitors!(nodes[1], 4);
- let mut bs_2nd_claim = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut bs_2nd_claim = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[1].node.handle_commitment_signed_batch_test(node_a_id, &as_third_cs);
check_added_monitors!(nodes[1], 1);
@@ -3584,7 +3584,7 @@ fn no_extra_retries_on_back_to_back_fail() {
);
check_added_monitors(&nodes[1], 1);
- let bs_fail_update = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let bs_fail_update = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert_eq!(bs_fail_update.update_fail_htlcs.len(), 2);
nodes[0].node.handle_update_fail_htlc(node_b_id, &bs_fail_update.update_fail_htlcs[0]);
nodes[0].node.handle_update_fail_htlc(node_b_id, &bs_fail_update.update_fail_htlcs[1]);
@@ -3642,7 +3642,7 @@ fn no_extra_retries_on_back_to_back_fail() {
);
check_added_monitors(&nodes[1], 1);
- let bs_fail_update = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let bs_fail_update = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fail_htlc(node_b_id, &bs_fail_update.update_fail_htlcs[0]);
let commitment = &bs_fail_update.commitment_signed;
do_commitment_signed_dance(&nodes[0], &nodes[1], commitment, false, true);
@@ -3868,7 +3868,7 @@ fn test_simple_partial_retry() {
expect_and_process_pending_htlcs(&nodes[1], false);
check_added_monitors!(nodes[1], 1);
- let bs_second_forward = get_htlc_update_msgs!(nodes[1], node_c_id);
+ let bs_second_forward = get_htlc_update_msgs(&nodes[1], &node_c_id);
nodes[2].node.handle_update_add_htlc(node_b_id, &bs_second_forward.update_add_htlcs[0]);
let commitment = &bs_second_forward.commitment_signed;
do_commitment_signed_dance(&nodes[2], &nodes[1], commitment, false, false);
@@ -4058,7 +4058,7 @@ fn test_threaded_payment_retries() {
route.route_params = Some(new_route_params.clone());
nodes[0].router.expect_find_route(new_route_params, Ok(route.clone()));
- let bs_fail_updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let bs_fail_updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fail_htlc(node_b_id, &bs_fail_updates.update_fail_htlcs[0]);
// The "normal" commitment_signed_dance delivers the final RAA and then calls
// `check_added_monitors` to ensure only the one RAA-generated monitor update was created.
@@ -4127,12 +4127,12 @@ fn do_no_missing_sent_on_reload(persist_manager_with_payment: bool, at_midpoint:
expect_payment_claimed!(nodes[1], our_payment_hash, 1_000_000);
if at_midpoint {
- let mut updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fulfill_htlc(node_b_id, updates.update_fulfill_htlcs.remove(0));
nodes[0].node.handle_commitment_signed_batch_test(node_b_id, &updates.commitment_signed);
check_added_monitors!(nodes[0], 1);
} else {
- let mut fulfill = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut fulfill = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fulfill_htlc(node_b_id, fulfill.update_fulfill_htlcs.remove(0));
do_commitment_signed_dance(&nodes[0], &nodes[1], &fulfill.commitment_signed, false, false);
// Ignore the PaymentSent event which is now pending on nodes[0] - if we were to handle it we'd
@@ -4551,7 +4551,7 @@ fn test_retry_custom_tlvs() {
expect_htlc_failure_conditions(events, &[fail]);
check_added_monitors!(nodes[1], 1);
- let htlc_updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let htlc_updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
let msgs::CommitmentUpdate { update_fail_htlcs, commitment_signed, .. } = htlc_updates;
assert_eq!(update_fail_htlcs.len(), 1);
nodes[0].node.handle_update_fail_htlc(node_b_id, &update_fail_htlcs[0]);
@@ -4744,7 +4744,7 @@ fn do_test_custom_tlvs_consistency(
);
check_added_monitors!(nodes[3], 1);
- let fail_updates_1 = get_htlc_update_msgs!(nodes[3], node_c_id);
+ let fail_updates_1 = get_htlc_update_msgs(&nodes[3], &node_c_id);
nodes[2].node.handle_update_fail_htlc(node_d_id, &fail_updates_1.update_fail_htlcs[0]);
let commitment = &fail_updates_1.commitment_signed;
do_commitment_signed_dance(&nodes[2], &nodes[3], commitment, false, false);
@@ -4754,7 +4754,7 @@ fn do_test_custom_tlvs_consistency(
expect_and_process_pending_htlcs_and_htlc_handling_failed(&nodes[2], &[fail]);
check_added_monitors!(nodes[2], 1);
- let fail_updates_2 = get_htlc_update_msgs!(nodes[2], node_a_id);
+ let fail_updates_2 = get_htlc_update_msgs(&nodes[2], &node_a_id);
nodes[0].node.handle_update_fail_htlc(node_c_id, &fail_updates_2.update_fail_htlcs[0]);
let commitment = &fail_updates_2.commitment_signed;
do_commitment_signed_dance(&nodes[0], &nodes[2], commitment, false, false);
@@ -5229,7 +5229,7 @@ fn test_non_strict_forwarding() {
HTLCHandlingFailureType::Forward { node_id: Some(node_c_id), channel_id: routed_chan_id };
expect_htlc_failure_conditions(events, &[fail]);
- let updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fail_htlc(node_b_id, &updates.update_fail_htlcs[0]);
do_commitment_signed_dance(&nodes[0], &nodes[1], &updates.commitment_signed, false, false);
let events = nodes[0].node.get_and_clear_pending_events();
diff --git a/lightning/src/ln/priv_short_conf_tests.rs b/lightning/src/ln/priv_short_conf_tests.rs
index ce2da8d..9e7f511 100644
--- a/lightning/src/ln/priv_short_conf_tests.rs
+++ b/lightning/src/ln/priv_short_conf_tests.rs
@@ -94,7 +94,7 @@ fn test_priv_forwarding_rejection() {
);
check_added_monitors(&nodes[1], 1);
- let htlc_fail_updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let htlc_fail_updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert!(htlc_fail_updates.update_add_htlcs.is_empty());
assert_eq!(htlc_fail_updates.update_fail_htlcs.len(), 1);
assert!(htlc_fail_updates.update_fail_malformed_htlcs.is_empty());
@@ -622,7 +622,7 @@ fn test_inbound_scid_privacy() {
1,
);
- let mut updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fail_htlc(node_b_id, &updates.update_fail_htlcs[0]);
do_commitment_signed_dance(&nodes[0], &nodes[1], &updates.commitment_signed, false, false);
@@ -698,7 +698,7 @@ fn test_scid_alias_returned() {
nodes[0].node.send_payment_with_route(route.clone(), payment_hash, onion, id).unwrap();
check_added_monitors!(nodes[0], 1);
- let as_updates = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let as_updates = get_htlc_update_msgs(&nodes[0], &node_b_id);
nodes[1].node.handle_update_add_htlc(node_a_id, &as_updates.update_add_htlcs[0]);
do_commitment_signed_dance(&nodes[1], &nodes[0], &as_updates.commitment_signed, false, true);
@@ -711,7 +711,7 @@ fn test_scid_alias_returned() {
expect_htlc_failure_conditions(events, &expected_failures);
check_added_monitors!(nodes[1], 1);
- let bs_updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let bs_updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fail_htlc(node_b_id, &bs_updates.update_fail_htlcs[0]);
do_commitment_signed_dance(&nodes[0], &nodes[1], &bs_updates.commitment_signed, false, true);
@@ -735,7 +735,7 @@ fn test_scid_alias_returned() {
nodes[0].node.send_payment_with_route(route, payment_hash, onion, id).unwrap();
check_added_monitors!(nodes[0], 1);
- let as_updates = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let as_updates = get_htlc_update_msgs(&nodes[0], &node_b_id);
nodes[1].node.handle_update_add_htlc(node_a_id, &as_updates.update_add_htlcs[0]);
do_commitment_signed_dance(&nodes[1], &nodes[0], &as_updates.commitment_signed, false, true);
@@ -749,7 +749,7 @@ fn test_scid_alias_returned() {
);
check_added_monitors(&nodes[1], 1);
- let bs_updates = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let bs_updates = get_htlc_update_msgs(&nodes[1], &node_a_id);
nodes[0].node.handle_update_fail_htlc(node_b_id, &bs_updates.update_fail_htlcs[0]);
do_commitment_signed_dance(&nodes[0], &nodes[1], &bs_updates.commitment_signed, false, true);
diff --git a/lightning/src/ln/quiescence_tests.rs b/lightning/src/ln/quiescence_tests.rs
index 9b1eab9..6daf4d6 100644
--- a/lightning/src/ln/quiescence_tests.rs
+++ b/lightning/src/ln/quiescence_tests.rs
@@ -104,7 +104,7 @@ fn allow_shutdown_while_awaiting_quiescence(local_shutdown: bool) {
check_added_monitors!(local_node, 1);
// Attempt to send an HTLC, but don't fully commit it yet.
- let update_add = get_htlc_update_msgs!(local_node, remote_node_id);
+ let update_add = get_htlc_update_msgs(&local_node, &remote_node_id);
remote_node.node.handle_update_add_htlc(local_node_id, &update_add.update_add_htlcs[0]);
remote_node
.node
@@ -149,7 +149,7 @@ fn allow_shutdown_while_awaiting_quiescence(local_shutdown: bool) {
);
check_added_monitors(remote_node, 1);
- let update_fail = get_htlc_update_msgs!(remote_node, local_node_id);
+ let update_fail = get_htlc_update_msgs(&remote_node, &local_node_id);
local_node.node.handle_update_fail_htlc(remote_node_id, &update_fail.update_fail_htlcs[0]);
local_node
.node
@@ -201,7 +201,7 @@ fn test_quiescence_waits_for_async_signer_and_monitor_update() {
check_added_monitors(&nodes[1], 1);
expect_payment_claimed!(&nodes[1], payment_hash, payment_amount);
- let mut update = get_htlc_update_msgs!(&nodes[1], node_id_0);
+ let mut update = get_htlc_update_msgs(&nodes[1], &node_id_0);
nodes[0].node.handle_update_fulfill_htlc(node_id_1, update.update_fulfill_htlcs.remove(0));
nodes[0].node.handle_commitment_signed_batch_test(node_id_1, &update.commitment_signed);
check_added_monitors(&nodes[0], 1);
@@ -313,7 +313,7 @@ fn test_quiescence_on_final_revoke_and_ack_pending_monitor_update() {
let stfu = get_event_msg!(&nodes[1], MessageSendEvent::SendStfu, node_id_0);
nodes[0].node.handle_stfu(node_id_1, &stfu);
- let update_add = get_htlc_update_msgs!(&nodes[0], node_id_1);
+ let update_add = get_htlc_update_msgs(&nodes[0], &node_id_1);
nodes[1].node.handle_update_add_htlc(node_id_0, &update_add.update_add_htlcs[0]);
nodes[1].node.handle_commitment_signed_batch_test(node_id_0, &update_add.commitment_signed);
check_added_monitors(&nodes[1], 1);
@@ -385,7 +385,7 @@ fn quiescence_updates_go_to_holding_cell(fail_htlc: bool) {
nodes[0].node.send_payment_with_route(route2, payment_hash2, onion2, payment_id2).unwrap();
check_added_monitors!(&nodes[0], 1);
- let update_add = get_htlc_update_msgs!(&nodes[0], node_id_1);
+ let update_add = get_htlc_update_msgs(&nodes[0], &node_id_1);
nodes[1].node.handle_update_add_htlc(node_id_0, &update_add.update_add_htlcs[0]);
do_commitment_signed_dance(&nodes[1], &nodes[0], &update_add.commitment_signed, false, false);
expect_and_process_pending_htlcs(&nodes[1], false);
@@ -413,7 +413,7 @@ fn quiescence_updates_go_to_holding_cell(fail_htlc: bool) {
// Now that quiescence is over, nodes are allowed to make updates again. nodes[1] will have its
// outbound HTLC finally go out, along with the fail/claim of nodes[0]'s payment.
- let mut update = get_htlc_update_msgs!(&nodes[1], node_id_0);
+ let mut update = get_htlc_update_msgs(&nodes[1], &node_id_0);
check_added_monitors(&nodes[1], 1);
nodes[0].node.handle_update_add_htlc(node_id_1, &update.update_add_htlcs[0]);
if fail_htlc {
@@ -448,7 +448,7 @@ fn quiescence_updates_go_to_holding_cell(fail_htlc: bool) {
}
check_added_monitors(&nodes[0], 1);
- let mut update = get_htlc_update_msgs!(&nodes[0], node_id_1);
+ let mut update = get_htlc_update_msgs(&nodes[0], &node_id_1);
if fail_htlc {
nodes[1].node.handle_update_fail_htlc(node_id_0, &update.update_fail_htlcs[0]);
} else {
diff --git a/lightning/src/ln/reload_tests.rs b/lightning/src/ln/reload_tests.rs
index c1e46fd..cd69652 100644
--- a/lightning/src/ln/reload_tests.rs
+++ b/lightning/src/ln/reload_tests.rs
@@ -890,7 +890,7 @@ fn do_test_partial_claim_before_restart(persist_both_monitors: bool, double_rest
let mut fulfill = updates.update_fulfill_htlcs.remove(0);
nodes[2].node.handle_update_fulfill_htlc(nodes[3].node.get_our_node_id(), fulfill);
check_added_monitors!(nodes[2], 1);
- let cs_updates = get_htlc_update_msgs!(nodes[2], nodes[0].node.get_our_node_id());
+ let cs_updates = get_htlc_update_msgs(&nodes[2], &nodes[0].node.get_our_node_id());
expect_payment_forwarded!(nodes[2], nodes[0], nodes[3], Some(1000), false, false);
do_commitment_signed_dance(&nodes[2], &nodes[3], &updates.commitment_signed, false, true);
cs_updates
@@ -1268,7 +1268,7 @@ fn test_htlc_localremoved_persistence() {
RecipientOnionFields::spontaneous_empty(), Some(test_preimage), PaymentId(mismatch_payment_hash.0), None, session_privs).unwrap();
check_added_monitors!(nodes[0], 1);
- let updates = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
+ let updates = get_htlc_update_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
nodes[1].node.handle_update_add_htlc(nodes[0].node.get_our_node_id(), &updates.update_add_htlcs[0]);
do_commitment_signed_dance(&nodes[1], &nodes[0], &updates.commitment_signed, false, false);
expect_and_process_pending_htlcs(&nodes[1], false);
@@ -1276,7 +1276,7 @@ fn test_htlc_localremoved_persistence() {
check_added_monitors(&nodes[1], 1);
// Save the update_fail_htlc message for later comparison.
- let msgs = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let msgs = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
let htlc_fail_msg = msgs.update_fail_htlcs[0].clone();
// Reload nodes.
diff --git a/lightning/src/ln/reorg_tests.rs b/lightning/src/ln/reorg_tests.rs
index 8d7b3f5..f5b7b07 100644
--- a/lightning/src/ln/reorg_tests.rs
+++ b/lightning/src/ln/reorg_tests.rs
@@ -66,7 +66,7 @@ fn do_test_onchain_htlc_reorg(local_commitment: bool, claim: bool) {
nodes[2].node.claim_funds(our_payment_preimage);
expect_payment_claimed!(nodes[2], our_payment_hash, 1_000_000);
check_added_monitors!(nodes[2], 1);
- get_htlc_update_msgs!(nodes[2], nodes[1].node.get_our_node_id());
+ get_htlc_update_msgs(&nodes[2], &nodes[1].node.get_our_node_id());
let claim_txn = if local_commitment {
// Broadcast node 1 commitment txn to broadcast the HTLC-Timeout
@@ -141,7 +141,7 @@ fn do_test_onchain_htlc_reorg(local_commitment: bool, claim: bool) {
check_added_monitors!(nodes[1], 1);
// Which should result in an immediate claim/fail of the HTLC:
- let mut htlc_updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
+ let mut htlc_updates = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
if claim {
assert_eq!(htlc_updates.update_fulfill_htlcs.len(), 1);
nodes[0].node.handle_update_fulfill_htlc(nodes[1].node.get_our_node_id(), htlc_updates.update_fulfill_htlcs.remove(0));
@@ -198,7 +198,7 @@ fn test_counterparty_revoked_reorg() {
let payment_hash_4 = route_payment(&nodes[1], &[&nodes[0]], 4_000).1;
nodes[0].node.claim_funds(payment_preimage_3);
- let _ = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
+ let _ = get_htlc_update_msgs(&nodes[0], &nodes[1].node.get_our_node_id());
check_added_monitors!(nodes[0], 1);
expect_payment_claimed!(nodes[0], payment_hash_3, 4_000_000);
diff --git a/lightning/src/ln/shutdown_tests.rs b/lightning/src/ln/shutdown_tests.rs
index 03f0702..caf5b72 100644
--- a/lightning/src/ln/shutdown_tests.rs
+++ b/lightning/src/ln/shutdown_tests.rs
@@ -179,7 +179,7 @@ fn expect_channel_shutdown_state_with_htlc() {
expect_payment_claimed!(nodes[2], payment_hash_0, 100_000);
// Fulfil HTLCs on node1 and node0
- let mut updates = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let mut updates = get_htlc_update_msgs(&nodes[2], &node_b_id);
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fail_htlcs.is_empty());
assert!(updates.update_fail_malformed_htlcs.is_empty());
@@ -188,7 +188,7 @@ fn expect_channel_shutdown_state_with_htlc() {
nodes[1].node.handle_update_fulfill_htlc(node_c_id, updates.update_fulfill_htlcs.remove(0));
expect_payment_forwarded!(nodes[1], nodes[0], nodes[2], Some(1000), false, false);
check_added_monitors!(nodes[1], 1);
- let mut updates_2 = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut updates_2 = get_htlc_update_msgs(&nodes[1], &node_a_id);
do_commitment_signed_dance(&nodes[1], &nodes[2], &updates.commitment_signed, false, false);
// Still in "resolvingHTLCs" on chan1 after htlc removed on chan2
@@ -455,7 +455,7 @@ fn updates_shutdown_wait() {
check_added_monitors!(nodes[2], 1);
expect_payment_claimed!(nodes[2], payment_hash_0, 100_000);
- let mut updates = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let mut updates = get_htlc_update_msgs(&nodes[2], &node_b_id);
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fail_htlcs.is_empty());
assert!(updates.update_fail_malformed_htlcs.is_empty());
@@ -464,7 +464,7 @@ fn updates_shutdown_wait() {
nodes[1].node.handle_update_fulfill_htlc(node_c_id, updates.update_fulfill_htlcs.remove(0));
expect_payment_forwarded!(nodes[1], nodes[0], nodes[2], Some(1000), false, false);
check_added_monitors!(nodes[1], 1);
- let mut updates_2 = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut updates_2 = get_htlc_update_msgs(&nodes[1], &node_a_id);
do_commitment_signed_dance(&nodes[1], &nodes[2], &updates.commitment_signed, false, false);
assert!(updates_2.update_add_htlcs.is_empty());
@@ -550,7 +550,7 @@ fn do_htlc_fail_async_shutdown(blinded_recipient: bool) {
.send_payment(our_payment_hash, onion, id, route_params, Retry::Attempts(0))
.unwrap();
check_added_monitors!(nodes[0], 1);
- let updates = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let updates = get_htlc_update_msgs(&nodes[0], &node_b_id);
assert_eq!(updates.update_add_htlcs.len(), 1);
assert!(updates.update_fulfill_htlcs.is_empty());
assert!(updates.update_fail_htlcs.is_empty());
@@ -574,7 +574,7 @@ fn do_htlc_fail_async_shutdown(blinded_recipient: bool) {
);
check_added_monitors(&nodes[1], 1);
- let updates_2 = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let updates_2 = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert!(updates_2.update_add_htlcs.is_empty());
assert!(updates_2.update_fulfill_htlcs.is_empty());
assert_eq!(updates_2.update_fail_htlcs.len(), 1);
@@ -721,7 +721,7 @@ fn do_test_shutdown_rebroadcast(recv_count: u8) {
check_added_monitors!(nodes[2], 1);
expect_payment_claimed!(nodes[2], payment_hash, 100_000);
- let mut updates = get_htlc_update_msgs!(nodes[2], node_b_id);
+ let mut updates = get_htlc_update_msgs(&nodes[2], &node_b_id);
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fail_htlcs.is_empty());
assert!(updates.update_fail_malformed_htlcs.is_empty());
@@ -730,7 +730,7 @@ fn do_test_shutdown_rebroadcast(recv_count: u8) {
nodes[1].node.handle_update_fulfill_htlc(node_c_id, updates.update_fulfill_htlcs.remove(0));
expect_payment_forwarded!(nodes[1], nodes[0], nodes[2], Some(1000), false, false);
check_added_monitors!(nodes[1], 1);
- let mut updates_2 = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let mut updates_2 = get_htlc_update_msgs(&nodes[1], &node_a_id);
do_commitment_signed_dance(&nodes[1], &nodes[2], &updates.commitment_signed, false, false);
assert!(updates_2.update_add_htlcs.is_empty());
diff --git a/lightning/src/ln/splicing_tests.rs b/lightning/src/ln/splicing_tests.rs
index 29243ba..5c3499c 100644
--- a/lightning/src/ln/splicing_tests.rs
+++ b/lightning/src/ln/splicing_tests.rs
@@ -1067,7 +1067,7 @@ fn do_test_splice_reestablish(reload: bool, async_monitor_update: bool) {
let initial_commit_sig_for_acceptor =
negotiate_splice_tx(&nodes[0], &nodes[1], channel_id, initiator_contribution);
assert_eq!(initial_commit_sig_for_acceptor.htlc_signatures.len(), 1);
- let initial_commit_sig_for_initiator = get_htlc_update_msgs!(&nodes[1], node_id_0);
+ let initial_commit_sig_for_initiator = get_htlc_update_msgs(&nodes[1], &node_id_0);
assert_eq!(initial_commit_sig_for_initiator.commitment_signed.len(), 1);
assert_eq!(initial_commit_sig_for_initiator.commitment_signed[0].htlc_signatures.len(), 1);
diff --git a/lightning/src/ln/update_fee_tests.rs b/lightning/src/ln/update_fee_tests.rs
index d926798..6f2fa14 100644
--- a/lightning/src/ln/update_fee_tests.rs
+++ b/lightning/src/ln/update_fee_tests.rs
@@ -107,7 +107,7 @@ pub fn test_async_inbound_update_fee() {
check_added_monitors(&nodes[1], 1);
nodes[1].node.handle_revoke_and_ack(node_a_id, &as_revoke_and_ack); // deliver (2)
- let bs_update = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let bs_update = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert!(bs_update.update_add_htlcs.is_empty()); // (4)
assert!(bs_update.update_fulfill_htlcs.is_empty()); // (4)
assert!(bs_update.update_fail_htlcs.is_empty()); // (4)
@@ -116,7 +116,7 @@ pub fn test_async_inbound_update_fee() {
check_added_monitors(&nodes[1], 1);
nodes[0].node.handle_revoke_and_ack(node_b_id, &bs_revoke_and_ack); // deliver (3)
- let as_update = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let as_update = get_htlc_update_msgs(&nodes[0], &node_b_id);
assert!(as_update.update_add_htlcs.is_empty()); // (5)
assert!(as_update.update_fulfill_htlcs.is_empty()); // (5)
assert!(as_update.update_fail_htlcs.is_empty()); // (5)
@@ -289,7 +289,7 @@ pub fn test_multi_flight_update_fee() {
// Deliver (1), generating (3) and (4)
nodes[0].node.handle_revoke_and_ack(node_b_id, &bs_revoke_msg);
- let as_second_update = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let as_second_update = get_htlc_update_msgs(&nodes[0], &node_b_id);
check_added_monitors(&nodes[0], 1);
assert!(as_second_update.update_add_htlcs.is_empty());
assert!(as_second_update.update_fulfill_htlcs.is_empty());
@@ -439,7 +439,7 @@ pub fn do_test_update_fee_that_funder_cannot_afford(channel_type_features: Chann
}
nodes[0].node.timer_tick_occurred();
check_added_monitors(&nodes[0], 1);
- let update_msg = get_htlc_update_msgs!(nodes[0], node_b_id);
+ let update_msg = get_htlc_update_msgs(&nodes[0], &node_b_id);
nodes[1].node.handle_update_fee(node_a_id, &update_msg.update_fee.unwrap());
@@ -692,7 +692,7 @@ pub fn test_update_fee_with_fundee_update_add_htlc() {
check_added_monitors(&nodes[1], 1);
// AwaitingRemoteRevoke ends here
- let commitment_update = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let commitment_update = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert_eq!(commitment_update.update_add_htlcs.len(), 1);
assert_eq!(commitment_update.update_fulfill_htlcs.len(), 0);
assert_eq!(commitment_update.update_fail_htlcs.len(), 0);
@@ -834,7 +834,7 @@ pub fn test_update_fee() {
// Deliver (6), creating (7):
nodes[1].node.handle_revoke_and_ack(node_a_id, &revoke_msg_0);
- let commitment_update = get_htlc_update_msgs!(nodes[1], node_a_id);
+ let commitment_update = get_htlc_update_msgs(&nodes[1], &node_a_id);
assert!(commitment_update.update_add_htlcs.is_empty());
assert!(commitment_update.update_fulfill_htlcs.is_empty());
assert!(commitment_update.update_fail_htlcs.is_empty());
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.