Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::chain_apis::trx_finality_status_processing Class Reference

#include <trx_finality_status_processing.hpp>

Classes

struct  chain_state
 
struct  trx_state
 

Public Member Functions

 trx_finality_status_processing (uint64_t max_storage, const fc::microseconds &success_duration, const fc::microseconds &failure_duration)
 
 ~trx_finality_status_processing ()
 
void signal_applied_transaction (const chain::transaction_trace_ptr &trace, const chain::packed_transaction_ptr &ptrx)
 
void signal_accepted_block (const chain::block_state_ptr &bsp)
 
void signal_irreversible_block (const chain::block_state_ptr &bsp)
 
void signal_block_start (uint32_t block_num)
 
chain_state get_chain_state () const
 
std::optional< trx_stateget_trx_state (const chain::transaction_id_type &id) const
 
size_t get_storage_memory_size () const
 

Detailed Description

This class manages the processing related to the transaction finality status feature.

Definition at line 16 of file trx_finality_status_processing.hpp.

Constructor & Destructor Documentation

◆ trx_finality_status_processing()

sysio::chain_apis::trx_finality_status_processing::trx_finality_status_processing ( uint64_t max_storage,
const fc::microseconds & success_duration,
const fc::microseconds & failure_duration )

Instantiate a new transaction retry processor

Parameters
max_storage- the maximum storage allotted to this feature

Definition at line 43 of file trx_finality_status_processing.cpp.

44 : _my(new trx_finality_status_processing_impl(max_storage, success_duration, failure_duration))
45 {
46 }

◆ ~trx_finality_status_processing()

sysio::chain_apis::trx_finality_status_processing::~trx_finality_status_processing ( )
default

Member Function Documentation

◆ get_chain_state()

trx_finality_status_processing::chain_state sysio::chain_apis::trx_finality_status_processing::get_chain_state ( ) const

Definition at line 306 of file trx_finality_status_processing.cpp.

306 {
307 return { .head_id = _my->_head_block_id, .head_block_timestamp = _my->_head_block_timestamp, .irr_id = _my->_irr_block_id, .irr_block_timestamp = _my->_irr_block_timestamp, .earliest_tracked_block_id = _my->_earliest_tracked_block_id };
308 }
Here is the caller graph for this function:

◆ get_storage_memory_size()

size_t sysio::chain_apis::trx_finality_status_processing::get_storage_memory_size ( ) const

Definition at line 333 of file trx_finality_status_processing.cpp.

333 {
334 return _my->_storage.memory_size();
335 }
Here is the caller graph for this function:

◆ get_trx_state()

std::optional< trx_finality_status_processing::trx_state > sysio::chain_apis::trx_finality_status_processing::get_trx_state ( const chain::transaction_id_type & id) const

Definition at line 310 of file trx_finality_status_processing.cpp.

310 {
311 auto iter = _my->_storage.find(id);
312 if (iter == _my->_storage.index().cend()) {
313 return {};
314 }
315
316 const char* status;
317 if (!iter->is_in_block()) {
318 if (fc::time_point::now() >= iter->trx_expiry) {
319 status = "FAILED";
320 }
321 else {
322 status = iter->forked_out ? "FORKED_OUT" : "LOCALLY_APPLIED";
323 }
324 }
325 else {
326 const auto block_num = iter->block_num();
327 const auto lib = chain::block_header::num_from_id(_my->_irr_block_id);
328 status = (block_num > lib) ? "IN_BLOCK" : "IRREVERSIBLE";
329 }
330 return trx_finality_status_processing::trx_state{ .block_id = iter->block_id, .block_timestamp = iter->block_timestamp, .received = iter->received, .expiration = iter->trx_expiry, .status = status };
331 }
static time_point now()
Definition time.cpp:14
static uint32_t num_from_id(const block_id_type &id)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ signal_accepted_block()

void sysio::chain_apis::trx_finality_status_processing::signal_accepted_block ( const chain::block_state_ptr & bsp)

Definition at line 70 of file trx_finality_status_processing.cpp.

70 {
71 try {
72 _my->signal_accepted_block(bsp);
73 } FC_LOG_AND_DROP(("Failed to signal accepted block for finality status"));
74 }
#define FC_LOG_AND_DROP(...)
Here is the caller graph for this function:

◆ signal_applied_transaction()

void sysio::chain_apis::trx_finality_status_processing::signal_applied_transaction ( const chain::transaction_trace_ptr & trace,
const chain::packed_transaction_ptr & ptrx )

Definition at line 64 of file trx_finality_status_processing.cpp.

64 {
65 try {
66 _my->signal_applied_transaction(trace, ptrx);
67 } FC_LOG_AND_DROP(("Failed to signal applied transaction for finality status"));
68 }
Here is the caller graph for this function:

◆ signal_block_start()

void sysio::chain_apis::trx_finality_status_processing::signal_block_start ( uint32_t block_num)

Definition at line 57 of file trx_finality_status_processing.cpp.

57 {
58 try {
59 // since a new block is started, no block state was received, so the speculative block did not get eventually produced
60 _my->_speculative_trxs.clear();
61 } FC_LOG_AND_DROP(("Failed to signal block start for finality status"));
62 }
Here is the caller graph for this function:

◆ signal_irreversible_block()

void sysio::chain_apis::trx_finality_status_processing::signal_irreversible_block ( const chain::block_state_ptr & bsp)

Definition at line 50 of file trx_finality_status_processing.cpp.

50 {
51 try {
52 _my->_irr_block_id = bsp->id;
53 _my->_irr_block_timestamp = bsp->block->timestamp;
54 } FC_LOG_AND_DROP(("Failed to signal irreversible block for finality status"));
55 }
Here is the caller graph for this function:

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