Skip to content

Commit ac9f152

Browse files
committed
Some cleanup
1 parent f3d29e2 commit ac9f152

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/ln/channelmanager.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,6 +1941,7 @@ impl ChannelManager {
19411941
// If the update_add is completely bogus, the call will Err and we will close,
19421942
// but if we've sent a shutdown and they haven't acknowledged it yet, we just
19431943
// want to reject the new HTLC and fail it backwards instead of forwarding.
1944+
println!("Channel no usable");
19441945
if let PendingHTLCStatus::Forward(PendingForwardHTLCInfo { incoming_shared_secret, .. }) = pending_forward_info {
19451946
pending_forward_info = PendingHTLCStatus::Fail(HTLCFailureMsg::Relay(msgs::UpdateFailHTLC {
19461947
channel_id: msg.channel_id,
@@ -1949,6 +1950,7 @@ impl ChannelManager {
19491950
}));
19501951
}
19511952
}
1953+
println!("just update_add_htlc");
19521954
chan.update_add_htlc(&msg, pending_forward_info).map_err(|e| MsgHandleErrInternal::from_maybe_close(e))
19531955
},
19541956
None => return Err(MsgHandleErrInternal::send_err_msg_no_close("Failed to find corresponding channel", msg.channel_id))
@@ -7555,12 +7557,11 @@ mod tests {
75557557
}).expect("RNG is bad!");
75567558

75577559
let cur_height = nodes[0].node.latest_block_height.load(Ordering::Acquire) as u32 + 1;
7558-
75597560
let onion_keys = ChannelManager::construct_onion_keys(&secp_ctx, &route, &session_priv).unwrap();
7560-
75617561
let (onion_payloads, htlc_msat, htlc_cltv) = ChannelManager::build_onion_payloads(&route, cur_height).unwrap();
75627562
let mut onion_packet = ChannelManager::construct_onion_packet(onion_payloads, onion_keys, &our_payment_preimage);
75637563

7564+
//Introduce an incorrect onion_packet_version
75647565
onion_packet.version = 1;
75657566

75667567
let mut channel_state = nodes[0].node.channel_state.lock().unwrap();
@@ -7570,14 +7571,15 @@ mod tests {
75707571
route: route.clone(),
75717572
session_priv: session_priv.clone(),
75727573
first_hop_htlc_msat: htlc_msat,
7573-
}, onion_packet).unwrap().unwrap()//.map_err(|he| APIError::ChannelUnavailable{err: he.err}).unwrap()
7574+
}, onion_packet).unwrap().unwrap()
75747575
};
75757576

75767577
println!("Mesg: {:?}", update_add.onion_routing_packet.version);
75777578

75787579
let res = nodes[1].node.handle_update_add_htlc(&nodes[0].node.get_our_node_id(),&update_add);
7579-
//This does create a PendingHTLCStatus::Fail situation that seems is maybe sent back to the node
7580-
//and is finally handled in channel::revoke_and_ack(...)
7580+
7581+
7582+
75817583

75827584
println!("Bolt4: {:?}", res);
75837585

0 commit comments

Comments
 (0)