Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::chain::transaction_metadata Class Reference

#include <transaction_metadata.hpp>

Public Types

enum class  trx_type { input , implicit , scheduled , read_only }
 

Public Member Functions

 transaction_metadata (const private_type &pt, packed_transaction_ptr ptrx, fc::microseconds sig_cpu_usage, flat_set< public_key_type > recovered_pub_keys, bool _implicit=false, bool _scheduled=false, bool _read_only=false)
 
 transaction_metadata ()=delete
 
 transaction_metadata (const transaction_metadata &)=delete
 
 transaction_metadata (transaction_metadata &&)=delete
 
transaction_metadata operator= (transaction_metadata &)=delete
 
transaction_metadata operator= (transaction_metadata &&)=delete
 
const packed_transaction_ptrpacked_trx () const
 
const transaction_id_typeid () const
 
fc::microseconds signature_cpu_usage () const
 
const flat_set< public_key_type > & recovered_keys () const
 
size_t get_estimated_size () const
 

Static Public Member Functions

static recover_keys_future start_recover_keys (packed_transaction_ptr trx, boost::asio::io_context &thread_pool, const chain_id_type &chain_id, fc::microseconds time_limit, trx_type t, uint32_t max_variable_sig_size=UINT32_MAX)
 
static transaction_metadata_ptr create_no_recover_keys (packed_transaction_ptr trx, trx_type t)
 

Public Attributes

const bool implicit
 
const bool scheduled
 
const bool read_only
 
bool accepted = false
 
uint32_t billed_cpu_time_us = 0
 

Detailed Description

This data structure should store context-free cached data about a transaction such as packed/unpacked/compressed and recovered keys

Definition at line 21 of file transaction_metadata.hpp.

Member Enumeration Documentation

◆ trx_type

Constructor & Destructor Documentation

◆ transaction_metadata() [1/4]

sysio::chain::transaction_metadata::transaction_metadata ( const private_type & pt,
packed_transaction_ptr ptrx,
fc::microseconds sig_cpu_usage,
flat_set< public_key_type > recovered_pub_keys,
bool _implicit = false,
bool _scheduled = false,
bool _read_only = false )
inlineexplicit

Definition at line 53 of file transaction_metadata.hpp.

56 : _packed_trx( std::move( ptrx ) )
57 , _sig_cpu_usage( sig_cpu_usage )
58 , _recovered_pub_keys( std::move( recovered_pub_keys ) )
59 , implicit( _implicit )
60 , scheduled( _scheduled )
61 , read_only( _read_only) {
62 }

◆ transaction_metadata() [2/4]

sysio::chain::transaction_metadata::transaction_metadata ( )
delete

◆ transaction_metadata() [3/4]

sysio::chain::transaction_metadata::transaction_metadata ( const transaction_metadata & )
delete

◆ transaction_metadata() [4/4]

sysio::chain::transaction_metadata::transaction_metadata ( transaction_metadata && )
delete

Member Function Documentation

◆ create_no_recover_keys()

static transaction_metadata_ptr sysio::chain::transaction_metadata::create_no_recover_keys ( packed_transaction_ptr trx,
trx_type t )
inlinestatic
Returns
constructed transaction_metadata with no key recovery (sig_cpu_usage=0, recovered_pub_keys=empty)

Definition at line 86 of file transaction_metadata.hpp.

86 {
87 return std::make_shared<transaction_metadata>( private_type(), std::move(trx),
88 fc::microseconds(), flat_set<public_key_type>(), t == trx_type::implicit, t == trx_type::scheduled, t==trx_type::read_only );
89 }
Here is the caller graph for this function:

◆ get_estimated_size()

size_t sysio::chain::transaction_metadata::get_estimated_size ( ) const

Definition at line 27 of file transaction_metadata.cpp.

27 {
28 return sizeof(*this) + _recovered_pub_keys.size() * sizeof(public_key_type) + packed_trx()->get_estimated_size();
29}
const packed_transaction_ptr & packed_trx() const
fc::crypto::public_key public_key_type
Definition types.hpp:76
Here is the call graph for this function:

◆ id()

const transaction_id_type & sysio::chain::transaction_metadata::id ( ) const
inline

Definition at line 72 of file transaction_metadata.hpp.

72{ return _packed_trx->id(); }

◆ operator=() [1/2]

transaction_metadata sysio::chain::transaction_metadata::operator= ( transaction_metadata && )
delete

◆ operator=() [2/2]

transaction_metadata sysio::chain::transaction_metadata::operator= ( transaction_metadata & )
delete

◆ packed_trx()

const packed_transaction_ptr & sysio::chain::transaction_metadata::packed_trx ( ) const
inline

Definition at line 71 of file transaction_metadata.hpp.

71{ return _packed_trx; }
Here is the caller graph for this function:

◆ recovered_keys()

const flat_set< public_key_type > & sysio::chain::transaction_metadata::recovered_keys ( ) const
inline

Definition at line 74 of file transaction_metadata.hpp.

74{ return _recovered_pub_keys; }

◆ signature_cpu_usage()

fc::microseconds sysio::chain::transaction_metadata::signature_cpu_usage ( ) const
inline

Definition at line 73 of file transaction_metadata.hpp.

73{ return _sig_cpu_usage; }

◆ start_recover_keys()

recover_keys_future sysio::chain::transaction_metadata::start_recover_keys ( packed_transaction_ptr trx,
boost::asio::io_context & thread_pool,
const chain_id_type & chain_id,
fc::microseconds time_limit,
trx_type t,
uint32_t max_variable_sig_size = UINT32_MAX )
static

Thread safe.

Returns
transaction_metadata_ptr or exception via future

Definition at line 7 of file transaction_metadata.cpp.

13{
14 return async_thread_pool( thread_pool, [trx{std::move(trx)}, chain_id, time_limit, t, max_variable_sig_size]() mutable {
15 fc::time_point deadline = time_limit == fc::microseconds::maximum() ?
16 fc::time_point::maximum() : fc::time_point::now() + time_limit;
17 check_variable_sig_size( trx, max_variable_sig_size );
18 const signed_transaction& trn = trx->get_signed_transaction();
19 flat_set<public_key_type> recovered_pub_keys;
20 fc::microseconds cpu_usage = trn.get_signature_keys( chain_id, deadline, recovered_pub_keys );
21 return std::make_shared<transaction_metadata>( private_type(), std::move( trx ), cpu_usage, std::move( recovered_pub_keys ),
23 }
24 );
25}
static constexpr microseconds maximum()
Definition time.hpp:14
static constexpr time_point maximum()
Definition time.hpp:46
namespace sysio::chain
Definition authority.cpp:3
auto async_thread_pool(boost::asio::io_context &thread_pool, F &&f)
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ accepted

bool sysio::chain::transaction_metadata::accepted = false

Definition at line 39 of file transaction_metadata.hpp.

◆ billed_cpu_time_us

uint32_t sysio::chain::transaction_metadata::billed_cpu_time_us = 0

Definition at line 40 of file transaction_metadata.hpp.

◆ implicit

const bool sysio::chain::transaction_metadata::implicit

Definition at line 36 of file transaction_metadata.hpp.

◆ read_only

const bool sysio::chain::transaction_metadata::read_only

Definition at line 38 of file transaction_metadata.hpp.

◆ scheduled

const bool sysio::chain::transaction_metadata::scheduled

Definition at line 37 of file transaction_metadata.hpp.


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