@@ -111,17 +111,17 @@ fd_restart_recv_last_voted_fork_slots( fd_restart_t * restart,
111
111
112
112
/* Decode the bitmap in the message and aggregate validator stake into slot_to_stake */
113
113
/* The gossip tile should have already converted the bitmap into raw format */
114
- if ( FD_UNLIKELY ( msg -> last_voted_slot + 1 < msg -> offsets .inner .raw_offsets .offsets . len ) ) {
114
+ if ( FD_UNLIKELY ( msg -> last_voted_slot + 1 < msg -> offsets .inner .raw_offsets .offsets_len ) ) {
115
115
FD_LOG_WARNING (( "Received invalid last_voted_fork_slot message from validator %s because %lu<%lu" ,
116
- FD_BASE58_ENC_32_ALLOCA ( pubkey ), msg -> last_voted_slot + 1 , msg -> offsets .inner .raw_offsets .offsets . len ));
116
+ FD_BASE58_ENC_32_ALLOCA ( pubkey ), msg -> last_voted_slot + 1 , msg -> offsets .inner .raw_offsets .offsets_len ));
117
117
}
118
- for ( ulong i = 0 ; i < msg -> offsets .inner .raw_offsets .offsets . len ; i ++ ) {
118
+ for ( ulong i = 0 ; i < msg -> offsets .inner .raw_offsets .offsets_len ; i ++ ) {
119
119
if ( FD_UNLIKELY ( msg -> last_voted_slot < restart -> funk_root + i ) ) break ;
120
120
121
121
ulong slot = msg -> last_voted_slot - i ;
122
122
ulong byte_off = i /BITS_PER_UCHAR ;
123
123
int bit_off = i %BITS_PER_UCHAR ;
124
- int bit = fd_uchar_extract_bit ( msg -> offsets .inner .raw_offsets .offsets . bits . bits [byte_off ], bit_off );
124
+ int bit = fd_uchar_extract_bit ( msg -> offsets .inner .raw_offsets .offsets_bitvec [byte_off ], bit_off );
125
125
if ( FD_LIKELY ( bit ) ) {
126
126
ulong offset = slot - restart -> funk_root ;
127
127
ulong slot_epoch = fd_slot_to_epoch ( restart -> epoch_schedule , slot , NULL );
@@ -189,7 +189,7 @@ fd_restart_recv_gossip_msg( fd_restart_t * restart,
189
189
Bitmap in raw format (uchar* - bitmap size is specified in the gossip message)
190
190
*/
191
191
fd_gossip_restart_last_voted_fork_slots_t * msg = (fd_gossip_restart_last_voted_fork_slots_t * ) fd_type_pun ( src );
192
- msg -> offsets .inner .raw_offsets .offsets . bits . bits = src + sizeof (fd_gossip_restart_last_voted_fork_slots_t );
192
+ msg -> offsets .inner .raw_offsets .offsets_bitvec = src + sizeof (fd_gossip_restart_last_voted_fork_slots_t );
193
193
fd_restart_recv_last_voted_fork_slots ( restart , msg , out_heaviest_fork_found );
194
194
}
195
195
}
@@ -315,10 +315,10 @@ fd_restart_convert_runlength_to_raw_bitmap( fd_gossip_restart_last_voted_fork_sl
315
315
bit_cnt += cnt ;
316
316
* out_bitmap_len = (bit_cnt - 1 )/BITS_PER_UCHAR + 1 ;
317
317
}
318
- msg -> offsets .discriminant = fd_restart_slots_offsets_enum_raw_offsets ;
319
- msg -> offsets .inner .raw_offsets .offsets . has_bits = 1 ;
320
- msg -> offsets .inner .raw_offsets .offsets . len = bit_cnt ;
321
- msg -> offsets .inner .raw_offsets .offsets . bits . bits_len = * out_bitmap_len ;
318
+ msg -> offsets .discriminant = fd_restart_slots_offsets_enum_raw_offsets ;
319
+ msg -> offsets .inner .raw_offsets .has_offsets = 1 ;
320
+ msg -> offsets .inner .raw_offsets .offsets_len = bit_cnt ;
321
+ msg -> offsets .inner .raw_offsets .offsets_bitvec_len = * out_bitmap_len ;
322
322
}
323
323
324
324
void
@@ -328,12 +328,12 @@ fd_restart_convert_raw_bitmap_to_runlength( fd_gossip_restart_last_voted_fork_sl
328
328
int last_bit = 1 ;
329
329
ulong offsets_len = 0 ;
330
330
for ( ulong raw_bitmap_iter = 0 ;
331
- raw_bitmap_iter < msg -> offsets .inner .raw_offsets .offsets . len &&
331
+ raw_bitmap_iter < msg -> offsets .inner .raw_offsets .offsets_len &&
332
332
offsets_len < FD_RESTART_PACKET_BITMAP_BYTES_MAX /sizeof (ushort );
333
333
raw_bitmap_iter ++ ) {
334
334
ulong idx = raw_bitmap_iter /BITS_PER_UCHAR ;
335
335
int off = raw_bitmap_iter %BITS_PER_UCHAR ;
336
- int bit = fd_uchar_extract_bit ( msg -> offsets .inner .raw_offsets .offsets . bits . bits [idx ], off );
336
+ int bit = fd_uchar_extract_bit ( msg -> offsets .inner .raw_offsets .offsets_bitvec [idx ], off );
337
337
if ( FD_LIKELY ( bit == last_bit ) ) {
338
338
cnt ++ ;
339
339
} else {
@@ -428,10 +428,10 @@ fd_restart_init( fd_restart_t * restart,
428
428
uchar * bitmap = out_buf + sizeof (fd_gossip_restart_last_voted_fork_slots_t );
429
429
fd_memset ( bitmap , 0 , num_slots /BITS_PER_UCHAR + 1 );
430
430
msg -> offsets .discriminant = fd_restart_slots_offsets_enum_raw_offsets ;
431
- msg -> offsets .inner .raw_offsets .offsets . has_bits = 1 ;
432
- msg -> offsets .inner .raw_offsets .offsets . len = num_slots ;
433
- msg -> offsets .inner .raw_offsets .offsets . bits . bits = bitmap ;
434
- msg -> offsets .inner .raw_offsets .offsets . bits . bits_len = ( num_slots - 1 )/BITS_PER_UCHAR + 1 ;
431
+ msg -> offsets .inner .raw_offsets .has_offsets = 1 ;
432
+ msg -> offsets .inner .raw_offsets .offsets_len = num_slots ;
433
+ msg -> offsets .inner .raw_offsets .offsets_bitvec = bitmap ;
434
+ msg -> offsets .inner .raw_offsets .offsets_bitvec_len = ( num_slots - 1 )/BITS_PER_UCHAR + 1 ;
435
435
* out_buf_len = sizeof (fd_gossip_restart_last_voted_fork_slots_t )+ ( num_slots - 1 )/BITS_PER_UCHAR + 1 ;
436
436
FD_LOG_NOTICE (( "[%s] last_voted_slot=%lu, bank_hash=%s, encoding %lu bits in bitmap" ,
437
437
__func__ , msg -> last_voted_slot , FD_BASE58_ENC_32_ALLOCA ( & tower_bank_hash ), num_slots ));
@@ -457,14 +457,14 @@ fd_restart_init( fd_restart_t * restart,
457
457
}
458
458
459
459
for ( ulong i = start_slot ; i < slot_history -> next_slot ; i ++ ) {
460
- ulong in_idx = ( i /BITS_PER_ULONG )%( slot_history -> bits . bits -> blocks_len );
460
+ ulong in_idx = ( i /BITS_PER_ULONG )%( slot_history -> bits_bitvec_len );
461
461
int in_bit_off = i %BITS_PER_ULONG ;
462
462
463
463
ulong offset_from_end = end_slot - i ;
464
464
ulong out_idx = offset_from_end /BITS_PER_UCHAR ;
465
465
int out_bit_off = offset_from_end %BITS_PER_UCHAR ;
466
466
467
- if ( FD_LIKELY ( fd_ulong_extract_bit ( slot_history -> bits . bits -> blocks [in_idx ], in_bit_off ) ) ) {
467
+ if ( FD_LIKELY ( fd_ulong_extract_bit ( slot_history -> bits_bitvec [in_idx ], in_bit_off ) ) ) {
468
468
/* bit#i in slot_history is 1 */
469
469
bitmap [out_idx ] = fd_uchar_set_bit ( bitmap [out_idx ], out_bit_off );
470
470
}
0 commit comments