@@ -473,11 +473,12 @@ fd_repair_send_requests( fd_repair_t * glob ) {
473
473
if ( dup && -- dup -> req_cnt == 0 ) {
474
474
fd_dupdetect_table_remove ( glob -> dupdetect , & ele -> dupkey );
475
475
}
476
+ FD_LOG_INFO (("removing old request for %lu, %u" , ele -> dupkey .slot , ele -> dupkey .shred_index ));
476
477
fd_needed_table_remove ( glob -> needed , & n );
477
478
}
478
479
glob -> oldest_nonce = n ;
479
480
480
- /* Send requests starting where we left off last time */
481
+ /* Send requests starting where we left off last time. i.e. if n < current_nonce, seek forward */
481
482
if ( (int )(n - glob -> current_nonce ) < 0 )
482
483
n = glob -> current_nonce ;
483
484
ulong j = 0 ;
@@ -488,7 +489,7 @@ fd_repair_send_requests( fd_repair_t * glob ) {
488
489
if ( NULL == ele )
489
490
continue ;
490
491
491
- if (j == 128U ) break ;
492
+ // if(j == 128U) break;
492
493
++ j ;
493
494
494
495
/* Track statistics */
@@ -503,6 +504,7 @@ fd_repair_send_requests( fd_repair_t * glob ) {
503
504
fd_needed_table_remove ( glob -> needed , & n );
504
505
continue ;
505
506
}
507
+ /* note these requests STAY in table even after being requested */
506
508
507
509
active -> avg_reqs ++ ;
508
510
glob -> metrics .send_pkt_cnt ++ ;
@@ -519,7 +521,7 @@ fd_repair_send_requests( fd_repair_t * glob ) {
519
521
wi -> header .nonce = n ;
520
522
wi -> slot = ele -> dupkey .slot ;
521
523
wi -> shred_index = ele -> dupkey .shred_index ;
522
- // FD_LOG_INFO(("[ repair]"))
524
+ FD_LOG_INFO (( " repair request for %lu, %lu" , wi -> slot , wi -> shred_index ));
523
525
break ;
524
526
}
525
527
@@ -533,6 +535,7 @@ fd_repair_send_requests( fd_repair_t * glob ) {
533
535
wi -> header .nonce = n ;
534
536
wi -> slot = ele -> dupkey .slot ;
535
537
wi -> shred_index = ele -> dupkey .shred_index ;
538
+ FD_LOG_INFO (( "repair request for %lu, %lu" , wi -> slot , wi -> shred_index ));
536
539
break ;
537
540
}
538
541
@@ -545,6 +548,7 @@ fd_repair_send_requests( fd_repair_t * glob ) {
545
548
wi -> header .timestamp = glob -> now /1000000L ;
546
549
wi -> header .nonce = n ;
547
550
wi -> slot = ele -> dupkey .slot ;
551
+ FD_LOG_INFO (( "repair request for %lu" , ele -> dupkey .slot ));
548
552
break ;
549
553
}
550
554
}
@@ -1057,18 +1061,37 @@ fd_repair_create_needed_request( fd_repair_t * glob, int type, ulong slot, uint
1057
1061
}
1058
1062
1059
1063
if (!found_peer ) {
1060
- FD_LOG_DEBUG ( ( "failed to find a good peer." ) );
1061
- fd_repair_unlock ( glob );
1062
- return -1 ;
1064
+ FD_LOG_WARNING ( ( "failed to find a good peer." ) );
1065
+ FD_LOG_WARNING ( ( "SO WE TRYING AGAIN " ));
1066
+ /* maybe atp we should just... send it. TODO: reevaluate wth testnet */
1067
+
1068
+ for ( ulong i = 0UL ; i < peer_cnt ; i ++ ) {
1069
+ fd_pubkey_t * id = & glob -> actives_sticky [i ];
1070
+ fd_active_elem_t * peer = fd_active_table_query ( glob -> actives , id , NULL );
1071
+ if ( peer ){
1072
+ peer -> first_request_time = glob -> now ;
1073
+ }
1074
+ }
1075
+
1076
+ // Can guarantee found peers now! lol
1077
+ for ( ulong i = 0UL ; i < peer_cnt ; i ++ ) {
1078
+ fd_active_elem_t * peer = actives_sample ( glob );
1079
+ if (!peer ) continue ;
1080
+ ids [i ] = & peer -> key ;
1081
+ }
1082
+ //fd_repair_unlock( glob );
1083
+ //return -1;
1063
1084
};
1064
1085
1065
1086
fd_dupdetect_key_t dupkey = { .type = (enum fd_needed_elem_type )type , .slot = slot , .shred_index = shred_index };
1066
1087
fd_dupdetect_elem_t * dupelem = fd_dupdetect_table_query ( glob -> dupdetect , & dupkey , NULL );
1067
1088
if ( dupelem == NULL ) {
1068
1089
dupelem = fd_dupdetect_table_insert ( glob -> dupdetect , & dupkey );
1069
1090
dupelem -> last_send_time = 0L ;
1070
- } else if ( ( dupelem -> last_send_time + (long )100e6 )< glob -> now ) {
1091
+ } else if ( ( dupelem -> last_send_time + (long )200e6 )> glob -> now ) {
1092
+ // if last send time > now - 100ms. then we don't want to add another.
1071
1093
fd_repair_unlock ( glob );
1094
+ //FD_LOG_INFO(("deduped request for %lu, %u", slot, shred_index));
1072
1095
return 0 ;
1073
1096
}
1074
1097
@@ -1081,13 +1104,14 @@ fd_repair_create_needed_request( fd_repair_t * glob, int type, ulong slot, uint
1081
1104
( * glob -> deliver_fail_fun )(ids [0 ], slot , shred_index , glob -> fun_arg , FD_REPAIR_DELIVER_FAIL_REQ_LIMIT_EXCEEDED );
1082
1105
return -1 ;
1083
1106
}
1084
- for ( ulong i = 0UL ; i < peer_cnt ; i ++ ) {
1107
+ for ( ulong i = 0UL ; i < fd_ulong_min ( fd_needed_table_key_max ( glob -> needed ) - fd_needed_table_key_cnt ( glob -> needed ), peer_cnt ) ; i ++ ) {
1085
1108
fd_repair_nonce_t key = glob -> next_nonce ++ ;
1086
1109
fd_needed_elem_t * val = fd_needed_table_insert (glob -> needed , & key );
1087
1110
fd_hash_copy (& val -> id , ids [i ]);
1088
1111
val -> dupkey = dupkey ;
1089
1112
val -> when = glob -> now ;
1090
1113
}
1114
+ FD_LOG_INFO (("added request for %lu, %u" , slot , shred_index ));
1091
1115
fd_repair_unlock ( glob );
1092
1116
return 0 ;
1093
1117
}
@@ -1163,7 +1187,7 @@ fd_repair_need_highest_window_index( fd_repair_t * glob, ulong slot, uint shred_
1163
1187
1164
1188
int
1165
1189
fd_repair_need_orphan ( fd_repair_t * glob , ulong slot ) {
1166
- FD_LOG_NOTICE ( ( "[%s ] need orphan %lu" , __func__ , slot ));
1190
+ FD_LOG_DEBUG ( ( "[repair ] need orphan %lu" , slot ) );
1167
1191
return fd_repair_create_needed_request ( glob , fd_needed_orphan , slot , UINT_MAX );
1168
1192
}
1169
1193
0 commit comments