Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::state_history::trace_converter Struct Reference

#include <trace_converter.hpp>

Public Member Functions

void add_transaction (const transaction_trace_ptr &trace, const chain::packed_transaction_ptr &transaction)
 
bytes pack (const chainbase::database &db, bool trace_debug_mode, const block_state_ptr &block_state)
 

Public Attributes

std::map< transaction_id_type, augmented_transaction_tracecached_traces
 
std::optional< augmented_transaction_traceonblock_trace
 

Detailed Description

Definition at line 12 of file trace_converter.hpp.

Member Function Documentation

◆ add_transaction()

void sysio::state_history::trace_converter::add_transaction ( const transaction_trace_ptr & trace,
const chain::packed_transaction_ptr & transaction )

Definition at line 7 of file trace_converter.cpp.

7 {
8 if (trace->receipt) {
9 if (chain::is_onblock(*trace))
10 onblock_trace.emplace(trace, transaction);
11 else if (trace->failed_dtrx_trace)
12 cached_traces[trace->failed_dtrx_trace->id] = augmented_transaction_trace{trace, transaction};
13 else
14 cached_traces[trace->id] = augmented_transaction_trace{trace, transaction};
15 }
16}
bool is_onblock(const transaction_trace &tt)
Definition trace.hpp:71
std::optional< augmented_transaction_trace > onblock_trace
std::map< transaction_id_type, augmented_transaction_trace > cached_traces
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pack()

bytes sysio::state_history::trace_converter::pack ( const chainbase::database & db,
bool trace_debug_mode,
const block_state_ptr & block_state )

Definition at line 18 of file trace_converter.cpp.

18 {
19 std::vector<augmented_transaction_trace> traces;
20 if (onblock_trace)
21 traces.push_back(*onblock_trace);
22 for (auto& r : block_state->block->transactions) {
24 if (std::holds_alternative<transaction_id_type>(r.trx))
25 id = std::get<transaction_id_type>(r.trx);
26 else
27 id = std::get<chain::packed_transaction>(r.trx).id();
28 auto it = cached_traces.find(id);
29 SYS_ASSERT(it != cached_traces.end() && it->second.trace->receipt, chain::plugin_exception,
30 "missing trace for transaction ${id}", ("id", id));
31 traces.push_back(it->second);
32 }
33 cached_traces.clear();
34 onblock_trace.reset();
35
36 return fc::raw::pack(make_history_context_wrapper(db, trace_debug_mode, traces));
37}
const mie::Vuint & r
Definition bn.cpp:28
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
Definition exceptions.hpp:7
uint64_t id
Definition code_cache.cpp:0
void pack(Stream &s, const std::deque< T > &value)
Definition raw.hpp:531
checksum_type transaction_id_type
Definition types.hpp:236
history_context_wrapper< std::decay_t< P >, std::decay_t< T > > make_history_context_wrapper(const chainbase::database &db, const P &context, const T &obj)
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ cached_traces

std::map<transaction_id_type, augmented_transaction_trace> sysio::state_history::trace_converter::cached_traces

Definition at line 13 of file trace_converter.hpp.

◆ onblock_trace

std::optional<augmented_transaction_trace> sysio::state_history::trace_converter::onblock_trace

Definition at line 14 of file trace_converter.hpp.


The documentation for this struct was generated from the following files: