@@ -46,7 +46,7 @@ use std::collections::{HashMap, hash_map, HashSet};
46
46
use std:: io:: Cursor ;
47
47
use std:: sync:: { Arc , Mutex , MutexGuard , RwLock } ;
48
48
use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
49
- use std:: time:: { Instant , Duration } ;
49
+ use std:: time:: Duration ;
50
50
51
51
// We hold various information about HTLC relay in the HTLC objects in Channel itself:
52
52
//
@@ -247,7 +247,6 @@ pub(super) enum RAACommitmentOrder {
247
247
pub ( super ) struct ChannelHolder {
248
248
pub ( super ) by_id : HashMap < [ u8 ; 32 ] , Channel > ,
249
249
pub ( super ) short_to_id : HashMap < u64 , [ u8 ; 32 ] > ,
250
- pub ( super ) next_forward : Instant ,
251
250
/// short channel id -> forward infos. Key of 0 means payments received
252
251
/// Note that while this is held in the same mutex as the channels themselves, no consistency
253
252
/// guarantees are made about the existence of a channel with the short id here, nor the short
@@ -266,7 +265,6 @@ pub(super) struct ChannelHolder {
266
265
pub ( super ) struct MutChannelHolder < ' a > {
267
266
pub ( super ) by_id : & ' a mut HashMap < [ u8 ; 32 ] , Channel > ,
268
267
pub ( super ) short_to_id : & ' a mut HashMap < u64 , [ u8 ; 32 ] > ,
269
- pub ( super ) next_forward : & ' a mut Instant ,
270
268
pub ( super ) forward_htlcs : & ' a mut HashMap < u64 , Vec < HTLCForwardInfo > > ,
271
269
pub ( super ) claimable_htlcs : & ' a mut HashMap < PaymentHash , Vec < ( u64 , HTLCPreviousHopData ) > > ,
272
270
pub ( super ) pending_msg_events : & ' a mut Vec < events:: MessageSendEvent > ,
@@ -276,7 +274,6 @@ impl ChannelHolder {
276
274
MutChannelHolder {
277
275
by_id : & mut self . by_id ,
278
276
short_to_id : & mut self . short_to_id ,
279
- next_forward : & mut self . next_forward ,
280
277
forward_htlcs : & mut self . forward_htlcs ,
281
278
claimable_htlcs : & mut self . claimable_htlcs ,
282
279
pending_msg_events : & mut self . pending_msg_events ,
@@ -549,7 +546,6 @@ impl ChannelManager {
549
546
channel_state : Mutex :: new ( ChannelHolder {
550
547
by_id : HashMap :: new ( ) ,
551
548
short_to_id : HashMap :: new ( ) ,
552
- next_forward : Instant :: now ( ) ,
553
549
forward_htlcs : HashMap :: new ( ) ,
554
550
claimable_htlcs : HashMap :: new ( ) ,
555
551
pending_msg_events : Vec :: new ( ) ,
@@ -1184,10 +1180,6 @@ impl ChannelManager {
1184
1180
let mut channel_state_lock = self . channel_state . lock ( ) . unwrap ( ) ;
1185
1181
let channel_state = channel_state_lock. borrow_parts ( ) ;
1186
1182
1187
- if cfg ! ( not( feature = "fuzztarget" ) ) && Instant :: now ( ) < * channel_state. next_forward {
1188
- return ;
1189
- }
1190
-
1191
1183
for ( short_chan_id, mut pending_forwards) in channel_state. forward_htlcs . drain ( ) {
1192
1184
if short_chan_id != 0 {
1193
1185
let forward_chan_id = match channel_state. short_to_id . get ( & short_chan_id) {
@@ -1467,8 +1459,7 @@ impl ChannelManager {
1467
1459
1468
1460
let mut forward_event = None ;
1469
1461
if channel_state_lock. forward_htlcs . is_empty ( ) {
1470
- forward_event = Some ( Instant :: now ( ) + Duration :: from_millis ( ( ( rng:: rand_f32 ( ) * 4.0 + 1.0 ) * MIN_HTLC_RELAY_HOLDING_CELL_MILLIS as f32 ) as u64 ) ) ;
1471
- channel_state_lock. next_forward = forward_event. unwrap ( ) ;
1462
+ forward_event = Some ( Duration :: from_millis ( ( ( rng:: rand_f32 ( ) * 4.0 + 1.0 ) * MIN_HTLC_RELAY_HOLDING_CELL_MILLIS as f32 ) as u64 ) ) ;
1472
1463
}
1473
1464
match channel_state_lock. forward_htlcs . entry ( short_channel_id) {
1474
1465
hash_map:: Entry :: Occupied ( mut entry) => {
@@ -2077,8 +2068,7 @@ impl ChannelManager {
2077
2068
if !pending_forwards. is_empty ( ) {
2078
2069
let mut channel_state = self . channel_state . lock ( ) . unwrap ( ) ;
2079
2070
if channel_state. forward_htlcs . is_empty ( ) {
2080
- forward_event = Some ( Instant :: now ( ) + Duration :: from_millis ( ( ( rng:: rand_f32 ( ) * 4.0 + 1.0 ) * MIN_HTLC_RELAY_HOLDING_CELL_MILLIS as f32 ) as u64 ) ) ;
2081
- channel_state. next_forward = forward_event. unwrap ( ) ;
2071
+ forward_event = Some ( Duration :: from_millis ( ( ( rng:: rand_f32 ( ) * 4.0 + 1.0 ) * MIN_HTLC_RELAY_HOLDING_CELL_MILLIS as f32 ) as u64 ) ) ;
2082
2072
}
2083
2073
for ( forward_info, prev_htlc_id) in pending_forwards. drain ( ..) {
2084
2074
match channel_state. forward_htlcs . entry ( forward_info. short_channel_id ) {
@@ -3087,7 +3077,6 @@ impl<'a, R : ::std::io::Read> ReadableArgs<R, ChannelManagerReadArgs<'a>> for (S
3087
3077
channel_state : Mutex :: new ( ChannelHolder {
3088
3078
by_id,
3089
3079
short_to_id,
3090
- next_forward : Instant :: now ( ) ,
3091
3080
forward_htlcs,
3092
3081
claimable_htlcs,
3093
3082
pending_msg_events : Vec :: new ( ) ,
0 commit comments