Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::chain::packed_transaction Struct Reference

#include <transaction.hpp>

Inheritance diagram for sysio::chain::packed_transaction:
Collaboration diagram for sysio::chain::packed_transaction:

Public Types

enum class  compression_type { none = 0 , zlib = 1 }
 

Public Member Functions

 packed_transaction ()=default
 
 packed_transaction (packed_transaction &&)=default
 
 packed_transaction (const packed_transaction &)=default
 
packed_transactionoperator= (const packed_transaction &)=delete
 
packed_transactionoperator= (packed_transaction &&)=default
 
 packed_transaction (const signed_transaction &t, compression_type _compression=compression_type::none)
 
 packed_transaction (signed_transaction &&t, compression_type _compression=compression_type::none)
 
 packed_transaction (bytes &&packed_txn, vector< signature_type > &&sigs, bytes &&packed_cfd, compression_type _compression)
 
 packed_transaction (bytes &&packed_txn, vector< signature_type > &&sigs, vector< bytes > &&cfd, compression_type _compression)
 
 packed_transaction (transaction &&t, vector< signature_type > &&sigs, bytes &&packed_cfd, compression_type _compression)
 
uint32_t get_unprunable_size () const
 
uint32_t get_prunable_size () const
 
size_t get_estimated_size () const
 
digest_type packed_digest () const
 
const transaction_id_typeid () const
 
bytes get_raw_transaction () const
 
time_point_sec expiration () const
 
const vector< bytes > & get_context_free_data () const
 
const transactionget_transaction () const
 
const signed_transactionget_signed_transaction () const
 
const vector< signature_type > & get_signatures () const
 
const fc::enum_type< uint8_t, compression_type > & get_compression () const
 
const bytesget_packed_context_free_data () const
 
const bytesget_packed_transaction () const
 

Friends

struct fc::reflector< packed_transaction >
 
struct fc::reflector_init_visitor< packed_transaction >
 
struct fc::has_reflector_init< packed_transaction >
 
bool operator== (const packed_transaction &lhs, const packed_transaction &rhs)
 
bool operator!= (const packed_transaction &lhs, const packed_transaction &rhs)
 

Detailed Description

Definition at line 136 of file transaction.hpp.

Member Enumeration Documentation

◆ compression_type

Constructor & Destructor Documentation

◆ packed_transaction() [1/8]

sysio::chain::packed_transaction::packed_transaction ( )
default

◆ packed_transaction() [2/8]

sysio::chain::packed_transaction::packed_transaction ( packed_transaction && )
default

◆ packed_transaction() [3/8]

sysio::chain::packed_transaction::packed_transaction ( const packed_transaction & )
explicitdefault

◆ packed_transaction() [4/8]

sysio::chain::packed_transaction::packed_transaction ( const signed_transaction & t,
compression_type _compression = compression_type::none )
inlineexplicit

Definition at line 148 of file transaction.hpp.

149 :signatures(t.signatures), compression(_compression), unpacked_trx(t), trx_id(unpacked_trx.id())
150 {
151 local_pack_transaction();
152 local_pack_context_free_data();
153 }
transaction_id_type id() const

◆ packed_transaction() [5/8]

sysio::chain::packed_transaction::packed_transaction ( signed_transaction && t,
compression_type _compression = compression_type::none )
inlineexplicit

Definition at line 155 of file transaction.hpp.

156 :signatures(t.signatures), compression(_compression), unpacked_trx(std::move(t)), trx_id(unpacked_trx.id())
157 {
158 local_pack_transaction();
159 local_pack_context_free_data();
160 }

◆ packed_transaction() [6/8]

sysio::chain::packed_transaction::packed_transaction ( bytes && packed_txn,
vector< signature_type > && sigs,
bytes && packed_cfd,
compression_type _compression )

Definition at line 283 of file transaction.cpp.

284:signatures(std::move(sigs))
285,compression(_compression)
286,packed_context_free_data(std::move(packed_cfd))
287,packed_trx(std::move(packed_txn))
288{
289 local_unpack_transaction({});
290 if( !packed_context_free_data.empty() ) {
291 local_unpack_context_free_data();
292 }
293}

◆ packed_transaction() [7/8]

sysio::chain::packed_transaction::packed_transaction ( bytes && packed_txn,
vector< signature_type > && sigs,
vector< bytes > && cfd,
compression_type _compression )

Definition at line 295 of file transaction.cpp.

296:signatures(std::move(sigs))
297,compression(_compression)
298,packed_trx(std::move(packed_txn))
299{
300 local_unpack_transaction( std::move( cfd ) );
301 if( !unpacked_trx.context_free_data.empty() ) {
302 local_pack_context_free_data();
303 }
304}
vector< bytes > context_free_data
for each context-free action, there is an entry here

◆ packed_transaction() [8/8]

sysio::chain::packed_transaction::packed_transaction ( transaction && t,
vector< signature_type > && sigs,
bytes && packed_cfd,
compression_type _compression )

Definition at line 306 of file transaction.cpp.

307:signatures(std::move(sigs))
308,compression(_compression)
309,packed_context_free_data(std::move(packed_cfd))
310,unpacked_trx(std::move(t), signatures, {})
311,trx_id(unpacked_trx.id())
312{
313 local_pack_transaction();
314 if( !packed_context_free_data.empty() ) {
315 local_unpack_context_free_data();
316 }
317}

Member Function Documentation

◆ expiration()

time_point_sec sysio::chain::packed_transaction::expiration ( ) const
inline

Definition at line 182 of file transaction.hpp.

182{ return unpacked_trx.expiration; }
time_point_sec expiration
the time at which a transaction expires

◆ get_compression()

const fc::enum_type< uint8_t, compression_type > & sysio::chain::packed_transaction::get_compression ( ) const
inline

Definition at line 187 of file transaction.hpp.

187{ return compression; }
Here is the caller graph for this function:

◆ get_context_free_data()

const vector< bytes > & sysio::chain::packed_transaction::get_context_free_data ( ) const
inline

Definition at line 183 of file transaction.hpp.

183{ return unpacked_trx.context_free_data; }
Here is the caller graph for this function:

◆ get_estimated_size()

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

Definition at line 150 of file transaction.cpp.

150 {
151 // transaction is stored packed (only transaction minus signed_transaction members) and unpacked (signed_transaction),
152 // double packed size, packed cfd size, and signature size to account for signed_transaction unpacked_trx size
153 return sizeof(*this) +
154 (signatures.size() * sizeof( signature_type )) * 2 +
155 packed_context_free_data.size() * 2 +
156 packed_trx.size() * 2;
157}
fc::crypto::signature signature_type
Definition types.hpp:78

◆ get_packed_context_free_data()

const bytes & sysio::chain::packed_transaction::get_packed_context_free_data ( ) const
inline

Definition at line 188 of file transaction.hpp.

188{ return packed_context_free_data; }
Here is the caller graph for this function:

◆ get_packed_transaction()

const bytes & sysio::chain::packed_transaction::get_packed_transaction ( ) const
inline

Definition at line 189 of file transaction.hpp.

189{ return packed_trx; }
Here is the caller graph for this function:

◆ get_prunable_size()

uint32_t sysio::chain::packed_transaction::get_prunable_size ( ) const

Definition at line 143 of file transaction.cpp.

143 {
144 uint64_t size = fc::raw::pack_size(signatures);
145 size += packed_context_free_data.size();
146 SYS_ASSERT( size <= std::numeric_limits<uint32_t>::max(), tx_too_big, "packed_transaction is too big" );
147 return static_cast<uint32_t>(size);
148}
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
Definition exceptions.hpp:7
size_t pack_size(const T &v)
Definition raw.hpp:671
unsigned int uint32_t
Definition stdint.h:126
unsigned __int64 uint64_t
Definition stdint.h:136
Here is the call graph for this function:

◆ get_raw_transaction()

bytes sysio::chain::packed_transaction::get_raw_transaction ( ) const

Definition at line 269 of file transaction.cpp.

270{
271 try {
272 switch(compression) {
274 return packed_trx;
276 return zlib_decompress(packed_trx);
277 default:
278 SYS_THROW(unknown_transaction_compression, "Unknown transaction compression algorithm");
279 }
280 } FC_CAPTURE_AND_RETHROW((compression)(packed_trx))
281}
#define SYS_THROW(exc_type, FORMAT,...)
#define FC_CAPTURE_AND_RETHROW(...)

◆ get_signatures()

const vector< signature_type > & sysio::chain::packed_transaction::get_signatures ( ) const
inline

Definition at line 186 of file transaction.hpp.

186{ return signatures; }
Here is the caller graph for this function:

◆ get_signed_transaction()

const signed_transaction & sysio::chain::packed_transaction::get_signed_transaction ( ) const
inline

Definition at line 185 of file transaction.hpp.

185{ return unpacked_trx; }
Here is the caller graph for this function:

◆ get_transaction()

const transaction & sysio::chain::packed_transaction::get_transaction ( ) const
inline

Definition at line 184 of file transaction.hpp.

184{ return unpacked_trx; }
Here is the caller graph for this function:

◆ get_unprunable_size()

uint32_t sysio::chain::packed_transaction::get_unprunable_size ( ) const

Definition at line 136 of file transaction.cpp.

136 {
137 uint64_t size = config::fixed_net_overhead_of_packed_trx;
138 size += packed_trx.size();
139 SYS_ASSERT( size <= std::numeric_limits<uint32_t>::max(), tx_too_big, "packed_transaction is too big" );
140 return static_cast<uint32_t>(size);
141}

◆ id()

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

Definition at line 179 of file transaction.hpp.

179{ return trx_id; }
Here is the caller graph for this function:

◆ operator=() [1/2]

packed_transaction & sysio::chain::packed_transaction::operator= ( const packed_transaction & )
delete

◆ operator=() [2/2]

packed_transaction & sysio::chain::packed_transaction::operator= ( packed_transaction && )
default

◆ packed_digest()

digest_type sysio::chain::packed_transaction::packed_digest ( ) const

Definition at line 160 of file transaction.cpp.

160 {
161 digest_type::encoder prunable;
162 fc::raw::pack( prunable, signatures );
163 fc::raw::pack( prunable, packed_context_free_data );
164
165 digest_type::encoder enc;
166 fc::raw::pack( enc, compression );
167 fc::raw::pack( enc, packed_trx );
168 fc::raw::pack( enc, prunable.result() );
169
170 return enc.result();
171}
void pack(Stream &s, const std::deque< T > &value)
Definition raw.hpp:531
Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ fc::has_reflector_init< packed_transaction >

friend struct fc::has_reflector_init< packed_transaction >
friend

Definition at line 195 of file transaction.hpp.

◆ fc::reflector< packed_transaction >

friend struct fc::reflector< packed_transaction >
friend

Definition at line 195 of file transaction.hpp.

◆ fc::reflector_init_visitor< packed_transaction >

Definition at line 195 of file transaction.hpp.

◆ operator!=

bool operator!= ( const packed_transaction & lhs,
const packed_transaction & rhs )
friend

Definition at line 171 of file transaction.hpp.

171{ return !(lhs == rhs); }

◆ operator==

bool operator== ( const packed_transaction & lhs,
const packed_transaction & rhs )
friend

Definition at line 167 of file transaction.hpp.

167 {
168 return std::tie(lhs.signatures, lhs.compression, lhs.packed_context_free_data, lhs.packed_trx) ==
169 std::tie(rhs.signatures, rhs.compression, rhs.packed_context_free_data, rhs.packed_trx);
170 }

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