///
/// Note that even though `BroadcastChannelAnnouncement` and `BroadcastChannelUpdate`
/// `msg_events` are stored under specific peers, this function does not fetch such `msg_events` as
/// such messages are intended to all peers.
///
/// Note that even though `BroadcastChannelAnnouncement` and `BroadcastChannelUpdate`
/// `msg_events` are stored under specific peers, this function does not fetch such `msg_events` as
/// such messages are intended to all peers.
let ev_index = msg_events.iter().position(|e| { match e {
MessageSendEvent::SendAcceptChannel { node_id, .. } => {
node_id == msg_node_id
let ev_index = msg_events.iter().position(|e| { match e {
MessageSendEvent::SendAcceptChannel { node_id, .. } => {
node_id == msg_node_id
- let mut updated_msg_events = msg_events.to_vec();
- let ev = updated_msg_events.remove(ev_index.unwrap());
- (ev, updated_msg_events)
+ msg_events.remove(ev_index.unwrap())
check_added_monitors!(node_b, 1);
node_b.node.handle_commitment_signed(&node_a.node.get_our_node_id(), &as_commitment_signed);
let (bs_revoke_and_ack, extra_msg_option) = {
check_added_monitors!(node_b, 1);
node_b.node.handle_commitment_signed(&node_a.node.get_our_node_id(), &as_commitment_signed);
let (bs_revoke_and_ack, extra_msg_option) = {
(match node_a_event {
MessageSendEvent::SendRevokeAndACK { ref node_id, ref msg } => {
assert_eq!(*node_id, node_a.node.get_our_node_id());
(match node_a_event {
MessageSendEvent::SendRevokeAndACK { ref node_id, ref msg } => {
assert_eq!(*node_id, node_a.node.get_our_node_id());
let mut events = origin_node.node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), expected_route.len());
for (path_idx, expected_path) in expected_route.iter().enumerate() {
let mut events = origin_node.node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), expected_route.len());
for (path_idx, expected_path) in expected_route.iter().enumerate() {
- let (ev, updated_events) = remove_first_msg_event_to_node(&expected_path[0].node.get_our_node_id(), &events);
- events = updated_events;
+ let ev = remove_first_msg_event_to_node(&expected_path[0].node.get_our_node_id(), &mut events);
// Once we've gotten through all the HTLCs, the last one should result in a
// PaymentClaimable (but each previous one should not!), .
let expect_payment = path_idx == expected_route.len() - 1;
// Once we've gotten through all the HTLCs, the last one should result in a
// PaymentClaimable (but each previous one should not!), .
let expect_payment = path_idx == expected_route.len() - 1;
} else {
for expected_path in expected_paths.iter() {
// For MPP payments, we always want the message to the first node in the path.
} else {
for expected_path in expected_paths.iter() {
// For MPP payments, we always want the message to the first node in the path.