Electroneum
tx_data_t Struct Reference
Collaboration diagram for tx_data_t:

Public Member Functions

 tx_data_t ()
 
 tx_data_t (const cryptonote::transaction &tx)
 
template<typename t_archive >
void serialize (t_archive &a, const unsigned int ver)
 

Public Attributes

std::vector< std::pair< uint64_t, std::vector< uint64_t > > > vin
 
std::vector< crypto::public_keyvout
 
bool coinbase
 

Detailed Description

Definition at line 83 of file blockchain_ancestry.cpp.

Constructor & Destructor Documentation

◆ tx_data_t() [1/2]

tx_data_t::tx_data_t ( )
inline

Definition at line 89 of file blockchain_ancestry.cpp.

89 : coinbase(false) {}

◆ tx_data_t() [2/2]

tx_data_t::tx_data_t ( const cryptonote::transaction tx)
inline

Definition at line 90 of file blockchain_ancestry.cpp.

91  {
92  coinbase = tx.vin.size() == 1 && tx.vin[0].type() == typeid(cryptonote::txin_gen);
93  if (!coinbase)
94  {
95  vin.reserve(tx.vin.size());
96  for (size_t ring = 0; ring < tx.vin.size(); ++ring)
97  {
98  if (tx.vin[ring].type() == typeid(cryptonote::txin_to_key))
99  {
100  const cryptonote::txin_to_key &txin = boost::get<cryptonote::txin_to_key>(tx.vin[ring]);
101  vin.push_back(std::make_pair(txin.amount, cryptonote::relative_output_offsets_to_absolute(txin.key_offsets)));
102  }
103  else
104  {
105  LOG_PRINT_L0("Bad vin type in txid " << get_transaction_hash(tx));
106  throw std::runtime_error("Bad vin type");
107  }
108  }
109  }
110  vout.reserve(tx.vout.size());
111  for (size_t out = 0; out < tx.vout.size(); ++out)
112  {
113  if (tx.vout[out].target.type() == typeid(cryptonote::txout_to_key))
114  {
115  const auto &txout = boost::get<cryptonote::txout_to_key>(tx.vout[out].target);
116  vout.push_back(txout.key);
117  }
118  else
119  {
120  LOG_PRINT_L0("Bad vout type in txid " << get_transaction_hash(tx));
121  throw std::runtime_error("Bad vout type");
122  }
123  }
124  }
std::vector< std::pair< uint64_t, std::vector< uint64_t > > > vin
#define LOG_PRINT_L0(x)
Definition: misc_log_ex.h:99
std::vector< uint64_t > key_offsets
std::vector< uint64_t > relative_output_offsets_to_absolute(const std::vector< uint64_t > &off)
std::vector< crypto::public_key > vout
crypto::hash get_transaction_hash(const transaction &t)
Here is the call graph for this function:

Member Function Documentation

◆ serialize()

template<typename t_archive >
void tx_data_t::serialize ( t_archive &  a,
const unsigned int  ver 
)
inline

Definition at line 126 of file blockchain_ancestry.cpp.

127  {
128  a & coinbase;
129  a & vin;
130  a & vout;
131  }
std::vector< std::pair< uint64_t, std::vector< uint64_t > > > vin
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
std::vector< crypto::public_key > vout

Member Data Documentation

◆ coinbase

bool tx_data_t::coinbase

Definition at line 87 of file blockchain_ancestry.cpp.

◆ vin

std::vector<std::pair<uint64_t, std::vector<uint64_t> > > tx_data_t::vin

Definition at line 85 of file blockchain_ancestry.cpp.

◆ vout

std::vector<crypto::public_key> tx_data_t::vout

Definition at line 86 of file blockchain_ancestry.cpp.


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