@@ -1941,6 +1941,7 @@ impl ChannelManager {
1941
1941
// If the update_add is completely bogus, the call will Err and we will close,
1942
1942
// but if we've sent a shutdown and they haven't acknowledged it yet, we just
1943
1943
// want to reject the new HTLC and fail it backwards instead of forwarding.
1944
+ println ! ( "Channel no usable" ) ;
1944
1945
if let PendingHTLCStatus :: Forward ( PendingForwardHTLCInfo { incoming_shared_secret, .. } ) = pending_forward_info {
1945
1946
pending_forward_info = PendingHTLCStatus :: Fail ( HTLCFailureMsg :: Relay ( msgs:: UpdateFailHTLC {
1946
1947
channel_id : msg. channel_id ,
@@ -1949,6 +1950,7 @@ impl ChannelManager {
1949
1950
} ) ) ;
1950
1951
}
1951
1952
}
1953
+ println ! ( "just update_add_htlc" ) ;
1952
1954
chan. update_add_htlc ( & msg, pending_forward_info) . map_err ( |e| MsgHandleErrInternal :: from_maybe_close ( e) )
1953
1955
} ,
1954
1956
None => return Err ( MsgHandleErrInternal :: send_err_msg_no_close ( "Failed to find corresponding channel" , msg. channel_id ) )
@@ -7555,12 +7557,11 @@ mod tests {
7555
7557
} ) . expect ( "RNG is bad!" ) ;
7556
7558
7557
7559
let cur_height = nodes[ 0 ] . node . latest_block_height . load ( Ordering :: Acquire ) as u32 + 1 ;
7558
-
7559
7560
let onion_keys = ChannelManager :: construct_onion_keys ( & secp_ctx, & route, & session_priv) . unwrap ( ) ;
7560
-
7561
7561
let ( onion_payloads, htlc_msat, htlc_cltv) = ChannelManager :: build_onion_payloads ( & route, cur_height) . unwrap ( ) ;
7562
7562
let mut onion_packet = ChannelManager :: construct_onion_packet ( onion_payloads, onion_keys, & our_payment_preimage) ;
7563
7563
7564
+ //Introduce an incorrect onion_packet_version
7564
7565
onion_packet. version = 1 ;
7565
7566
7566
7567
let mut channel_state = nodes[ 0 ] . node . channel_state . lock ( ) . unwrap ( ) ;
@@ -7570,14 +7571,15 @@ mod tests {
7570
7571
route : route. clone ( ) ,
7571
7572
session_priv : session_priv. clone ( ) ,
7572
7573
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 ( )
7574
7575
} ;
7575
7576
7576
7577
println ! ( "Mesg: {:?}" , update_add. onion_routing_packet. version) ;
7577
7578
7578
7579
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
+
7581
7583
7582
7584
println ! ( "Bolt4: {:?}" , res) ;
7583
7585
0 commit comments