@@ -86,7 +86,7 @@ typedef struct voted_on voted_on_t;
8686
8787struct block_result_key {
8888 fd_pubkey_t block_id ;
89- fd_pubkey_t block_hash ;
89+ fd_pubkey_t bank_hash ;
9090};
9191
9292typedef struct block_result_key block_result_key_t ;
@@ -126,8 +126,8 @@ typedef struct block_result block_result_t;
126126#define MAP_PREV map.prev
127127#define MAP_NEXT map.next
128128#define MAP_KEY_EQ (k0 ,k1 ) ( fd_pubkey_eq( &((k0)->block_id), &((k1)->block_id) ) &\
129- fd_pubkey_eq( &((k0)->block_hash ), &((k1)->block_hash ) ) )
130- #define MAP_KEY_HASH (key ,seed ) ( seed ^ fd_ulong_load_8( (key)->block_id.uc ) ^ fd_ulong_load_8( (key)->block_hash .uc ) )
129+ fd_pubkey_eq( &((k0)->bank_hash ), &((k1)->bank_hash ) ) )
130+ #define MAP_KEY_HASH (key ,seed ) ( seed ^ fd_ulong_load_8( (key)->block_id.uc ) ^ fd_ulong_load_8( (key)->bank_hash .uc ) )
131131#define MAP_OPTIMIZE_RANDOM_ACCESS_REMOVAL 1
132132#include "../../util/tmpl/fd_map_chain.c"
133133
@@ -139,7 +139,7 @@ typedef struct block_result block_result_t;
139139
140140struct my_result {
141141 fd_pubkey_t block_id ;
142- fd_pubkey_t block_hash ;
142+ fd_pubkey_t bank_hash ;
143143
144144 ulong slot ;
145145
@@ -332,7 +332,7 @@ fd_hard_fork_detector_new( void * shmem,
332332 FD_TEST ( hf -> my_vote_map );
333333
334334 hf -> my_vote_lru = my_vote_lru_join ( my_vote_lru_new ( _my_vote_lru ) );
335- FD_TEST ( hf -> my_vote_lru );
335+ FD_TEST ( hf -> my_vote_lru );
336336
337337 hf -> block_id_pool = block_id_pool_join ( block_id_pool_new ( _block_id_pool , max_live_slots * max_vote_accounts ) );
338338 FD_TEST ( hf -> block_id_pool );
@@ -412,16 +412,16 @@ check( fd_hard_fork_detector_t const * detector,
412412 if ( detector -> fatal ) FD_LOG_ERR (( "%s" , msg ));
413413 else FD_LOG_WARNING (( "%s" , msg ));
414414 } else {
415- if ( FD_UNLIKELY ( memcmp ( my_result -> block_hash .uc , block_result -> key .block_hash .uc , 32UL ) ) ) {
415+ if ( FD_UNLIKELY ( memcmp ( my_result -> bank_hash .uc , block_result -> key .bank_hash .uc , 32UL ) ) ) {
416416 char msg [ 4096UL ];
417417 FD_TEST ( fd_cstr_printf_check ( msg , sizeof ( msg ), NULL ,
418418 "HARD FORK DETECTED: our validator has produced block hash `%s` for slot %lu with block ID `%s`, but %lu validators with %.1f of stake have voted on a different block hash `%s` for the same slot" ,
419- FD_BASE58_ENC_32_ALLOCA ( my_result -> block_hash .uc ),
419+ FD_BASE58_ENC_32_ALLOCA ( my_result -> bank_hash .uc ),
420420 my_result -> slot ,
421421 FD_BASE58_ENC_32_ALLOCA ( my_result -> block_id .uc ),
422422 block_result -> voter_count ,
423423 100.0 * (double )block_result -> stake /(double )detector -> total_stake ,
424- FD_BASE58_ENC_32_ALLOCA ( block_result -> key .block_hash .uc ) ) );
424+ FD_BASE58_ENC_32_ALLOCA ( block_result -> key .bank_hash .uc ) ) );
425425
426426 if ( detector -> fatal ) FD_LOG_ERR (( "%s" , msg ));
427427 else FD_LOG_WARNING (( "%s" , msg ));
433433fd_hard_fork_detector_vote ( fd_hard_fork_detector_t * detector ,
434434 uchar const * vote_account ,
435435 uchar const * block_id ,
436- uchar const * block_hash ) {
436+ uchar const * bank_hash ) {
437437 stake_t const * _stake = stake_map_ele_query_const ( detector -> stake_map , fd_type_pun_const ( vote_account ), NULL , detector -> stake_pool );
438438 if ( FD_UNLIKELY ( !_stake ) ) return ; /* Don't care about votes from unstaked */
439439
@@ -482,9 +482,9 @@ fd_hard_fork_detector_vote( fd_hard_fork_detector_t * detector,
482482
483483 block_result_key_t br_key ;
484484 fd_memcpy ( br_key .block_id .uc , block_id , 32UL );
485- fd_memcpy ( br_key .block_hash .uc , block_hash , 32UL );
485+ fd_memcpy ( br_key .bank_hash .uc , bank_hash , 32UL );
486486
487- block_result_t * block_result = block_result_map_ele_query ( detector -> block_result_map , fd_type_pun_const ( block_hash ), NULL , detector -> block_result_pool );
487+ block_result_t * block_result = block_result_map_ele_query ( detector -> block_result_map , fd_type_pun_const ( bank_hash ), NULL , detector -> block_result_pool );
488488 if ( FD_UNLIKELY ( !block_result ) ) {
489489 /* Guaranteed to be space, because the block result pool is larger
490490 than the voted on pool, and there can be at most one unique
@@ -493,7 +493,7 @@ fd_hard_fork_detector_vote( fd_hard_fork_detector_t * detector,
493493
494494 block_result = block_result_pool_ele_acquire ( detector -> block_result_pool );
495495 fd_memcpy ( block_result -> key .block_id .uc , block_id , 32UL );
496- fd_memcpy ( block_result -> key .block_hash .uc , block_hash , 32UL );
496+ fd_memcpy ( block_result -> key .bank_hash .uc , bank_hash , 32UL );
497497 block_result -> stake = 0UL ;
498498 block_result_map_ele_insert ( detector -> block_result_map , block_result , detector -> block_result_pool );
499499 }
523523fd_hard_fork_detector_block ( fd_hard_fork_detector_t * detector ,
524524 ulong slot ,
525525 uchar const * block_id ,
526- uchar const * block_hash ) {
526+ uchar const * bank_hash ) {
527527 if ( FD_LIKELY ( !my_vote_pool_free ( detector -> my_vote_pool ) ) ) {
528528 /* Might also be good eventually to evict a little bit smarter here ... */
529529 my_result_t * lru_result = my_vote_lru_ele_pop_tail ( detector -> my_vote_lru , detector -> my_vote_pool );
@@ -534,10 +534,10 @@ fd_hard_fork_detector_block( fd_hard_fork_detector_t * detector,
534534 my_result_t * my_result = my_vote_pool_ele_acquire ( detector -> my_vote_pool );
535535 my_result -> slot = slot ;
536536 fd_memcpy ( my_result -> block_id .uc , block_id , 32UL );
537- fd_memcpy ( my_result -> block_hash .uc , block_hash , 32UL );
537+ fd_memcpy ( my_result -> bank_hash .uc , bank_hash , 32UL );
538538
539539 uchar zero32 [32 ] = {0 };
540- if ( FD_UNLIKELY ( !memcmp ( block_hash , zero32 , 32UL ) ) ) my_result -> invalid = 1 ;
540+ if ( FD_UNLIKELY ( !memcmp ( bank_hash , zero32 , 32UL ) ) ) my_result -> invalid = 1 ;
541541
542542 my_vote_map_ele_insert ( detector -> my_vote_map , my_result , detector -> my_vote_pool );
543543 my_vote_lru_ele_push_head ( detector -> my_vote_lru , my_result , detector -> my_vote_pool );
0 commit comments