Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
trace_converter.cpp
Go to the documentation of this file.
3
4namespace sysio {
5namespace state_history {
6
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
15 }
16}
17
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}
38
39} // namespace state_history
40} // namespace sysio
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
std::shared_ptr< transaction_trace > transaction_trace_ptr
Definition trace.hpp:20
std::shared_ptr< const packed_transaction > packed_transaction_ptr
bool is_onblock(const transaction_trace &tt)
Definition trace.hpp:71
std::shared_ptr< block_state > block_state_ptr
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)
bytes pack(const chainbase::database &db, bool trace_debug_mode, const block_state_ptr &block_state)
std::optional< augmented_transaction_trace > onblock_trace
void add_transaction(const transaction_trace_ptr &trace, const chain::packed_transaction_ptr &transaction)
std::map< transaction_id_type, augmented_transaction_trace > cached_traces