| 
19 | 19 | #include "../../flamenco/leaders/fd_multi_epoch_leaders.h"  | 
20 | 20 | #include "../../disco/metrics/fd_metrics.h"  | 
21 | 21 | 
 
  | 
 | 22 | +#include "../../flamenco/runtime/tests/fd_dump_pb.h"  | 
 | 23 | + | 
22 | 24 | #include <errno.h>  | 
23 | 25 | 
 
  | 
24 | 26 | /* Replay concepts:  | 
@@ -371,7 +373,6 @@ FD_FN_CONST static inline ulong  | 
371 | 373 | scratch_align( void ) {  | 
372 | 374 |   return 128UL;  | 
373 | 375 | }  | 
374 |  | - | 
375 | 376 | FD_FN_PURE static inline ulong  | 
376 | 377 | scratch_footprint( fd_topo_tile_t const * tile ) {  | 
377 | 378 |   ulong chain_cnt = fd_block_id_map_chain_cnt_est( tile->replay.max_live_slots );  | 
@@ -789,6 +790,37 @@ replay_block_finalize( fd_replay_tile_t *  ctx,  | 
789 | 790 |   }  | 
790 | 791 | 
 
  | 
791 | 792 |   fd_bank_hash_cmp_unlock( bank_hash_cmp );  | 
 | 793 | + | 
 | 794 | +  /* Block dumping */  | 
 | 795 | +  if( FD_LIKELY( !ctx->capture_ctx->dump_block_to_pb ) ) return;  | 
 | 796 | + | 
 | 797 | +  /* Get the bank for the parent slot */  | 
 | 798 | +  fd_bank_t * parent_bank = fd_banks_get_parent( ctx->banks, bank );  | 
 | 799 | +  if( FD_UNLIKELY( !parent_bank ) ) {  | 
 | 800 | +    FD_LOG_WARNING(( "Could not find parent bank for bank %lu", bank_idx ));  | 
 | 801 | +    return;  | 
 | 802 | +  }  | 
 | 803 | + | 
 | 804 | +  /* Get the parent funk txn xid */  | 
 | 805 | +  ulong parent_slot = fd_bank_slot_get( parent_bank );  | 
 | 806 | +  fd_funk_txn_xid_t parent_xid = { .ul = { parent_slot, parent_slot } };  | 
 | 807 | +  fd_funk_txn_t * parent_txn = fd_funk_txn_query( &parent_xid, ctx->funk->txn_map );  | 
 | 808 | +  if( FD_UNLIKELY( !parent_txn ) ) {  | 
 | 809 | +    FD_LOG_WARNING(( "Could not find parent funk txn for bank %lu", bank_idx ));  | 
 | 810 | +    return;  | 
 | 811 | +  }  | 
 | 812 | + | 
 | 813 | +  /* Fetch all transactions from the block  | 
 | 814 | +     TODO: Implement this */  | 
 | 815 | +  fd_block_id_ele_t * block_id_ele       = &ctx->block_id_arr[ bank->parent_idx ];  | 
 | 816 | +  fd_hash_t *         parent_merkle_root = &block_id_ele->block_id;  | 
 | 817 | +  fd_reasm_fec_t *    parent_fec         = fd_reasm_query( ctx->reasm, parent_merkle_root );  | 
 | 818 | +  FD_TEST( parent_fec ); // TODO: delete  | 
 | 819 | +  // fd_sched_block_t * block = block_pool_ele( ctx->sched, fec->bank_idx );  | 
 | 820 | + | 
 | 821 | + | 
 | 822 | +  /* Dump the block to pb */  | 
 | 823 | +  fd_dump_block_to_protobuf( ctx->banks, parent_bank, ctx->funk, &parent_xid, ctx->capture_ctx, ctx->runtime_spad );  | 
792 | 824 | }  | 
793 | 825 | 
 
  | 
794 | 826 | /**********************************************************************/  | 
 | 
0 commit comments