24 : store(
std::move(store))
25 , except_handler(
std::move(except_handler))
30 on_applied_transaction( trace, ptrx );
35 on_accepted_block( bsp );
40 on_irreversible_block( bsp );
45 on_block_start( block_num );
51 if( !trace->receipt )
return;
58 onblock_trace.emplace( cache_trace{trace, t} );
59 }
else if( trace->failed_dtrx_trace ) {
60 cached_traces[trace->failed_dtrx_trace->id] = {trace, t};
62 cached_traces[trace->id] = {trace, t};
67 store_block_trace( block_state );
71 store_lib( block_state );
74 void on_block_start(
uint32_t block_num ) {
79 cached_traces.clear();
80 onblock_trace.reset();
85 using transaction_trace_t = transaction_trace_v3;
88 std::vector<transaction_trace_t> traces;
89 traces.reserve( block_state->block->transactions.size() + 1 );
91 tt.ids.reserve(block_state->block->transactions.size() + 1);
94 for(
const auto&
r : block_state->block->transactions ) {
96 if( std::holds_alternative<transaction_id_type>(
r.trx)) {
97 id = std::get<transaction_id_type>(
r.trx);
99 id = std::get<packed_transaction>(
r.trx).id();
101 const auto it = cached_traces.find(
id );
102 if( it != cached_traces.end() ) {
105 tt.ids.emplace_back(
id);
107 bt.transactions = std::move( traces );
111 tt.block_num =
bt.number;
112 store.append_trx_ids( std::move(tt) );
114 store.append( std::move(
bt ) );
122 store.append_lib( bsp->block_num );
131 std::map<transaction_id_type, cache_trace> cached_traces;
132 std::optional<cache_trace> onblock_trace;