@@ -293,6 +293,7 @@ fd_txncache_finalize_fork( fd_txncache_t * tc,
293293
294294 blockcache_t * fork = & tc -> blockcache_pool [ fork_id .val ];
295295 FD_TEST ( fork -> shmem -> frozen <=1 );
296+ FD_TEST ( fork -> shmem -> frozen >=0 );
296297 fork -> shmem -> txnhash_offset = txnhash_offset ;
297298
298299 memcpy ( fork -> shmem -> blockhash .uc , blockhash , 32UL );
@@ -313,6 +314,7 @@ remove_blockcache( fd_txncache_t * tc,
313314 for ( ulong i = 0UL ; i < tc -> shmem -> active_slots_max ; i ++ ) descends_set_remove ( tc -> blockcache_pool [ i ].descends , idx );
314315
315316 if ( FD_LIKELY ( blockcache -> shmem -> frozen ) ) blockhash_map_ele_remove_fast ( tc -> blockhash_map , blockcache -> shmem , tc -> blockcache_shmem_pool );
317+ blockcache -> shmem -> frozen = -1 ;
316318 blockcache_pool_ele_release ( tc -> blockcache_shmem_pool , blockcache -> shmem );
317319}
318320
@@ -408,6 +410,7 @@ fd_txncache_insert( fd_txncache_t * tc,
408410
409411 blockcache_t const * fork = & tc -> blockcache_pool [ fork_id .val ];
410412 FD_TEST ( fork -> shmem -> frozen <=1 );
413+ FD_TEST ( fork -> shmem -> frozen >=0 );
411414 blockcache_t * blockcache = blockhash_on_fork ( tc , fork , blockhash );
412415
413416 /* TODO: We can't print the full txnhash here typically because we
@@ -444,6 +447,8 @@ fd_txncache_query( fd_txncache_t * tc,
444447
445448 blockcache_t const * fork = & tc -> blockcache_pool [ fork_id .val ];
446449 blockcache_t const * blockcache = blockhash_on_fork ( tc , fork , blockhash );
450+ FD_TEST ( fork -> shmem -> frozen >=0 );
451+ FD_TEST ( blockcache -> shmem -> frozen == 2 );
447452
448453 /* TODO: We can't print the full txnhash here typically because we
449454 might only be able to see 20 bytes, but we need to print it for
@@ -457,7 +462,8 @@ fd_txncache_query( fd_txncache_t * tc,
457462 for ( uint head = blockcache -> heads [ head_hash ]; head != UINT_MAX ; head = tc -> txnpages [ head /FD_TXNCACHE_TXNS_PER_PAGE ].txns [ head %FD_TXNCACHE_TXNS_PER_PAGE ]-> blockcache_next ) {
458463 fd_txncache_single_txn_t * txn = tc -> txnpages [ head /FD_TXNCACHE_TXNS_PER_PAGE ].txns [ head %FD_TXNCACHE_TXNS_PER_PAGE ];
459464
460- int descends = (txn -> fork_id .val == fork_id .val || descends_set_test ( fork -> descends , txn -> fork_id .val )) && fork -> shmem -> generation == txn -> generation ;
465+ blockcache_t const * txn_fork = & tc -> blockcache_pool [ txn -> fork_id .val ];
466+ int descends = (txn -> fork_id .val == fork_id .val || descends_set_test ( fork -> descends , txn -> fork_id .val )) && txn_fork -> shmem -> frozen >=0 && txn_fork -> shmem -> generation == txn -> generation ;
461467 if ( FD_LIKELY ( descends && !memcmp ( txnhash + txnhash_offset , txn -> txnhash , 20UL ) ) ) {
462468 found = 1 ;
463469 break ;
0 commit comments