Monero
Loading...
Searching...
No Matches
chaingen.cpp File Reference
#include <vector>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <array>
#include <random>
#include <fstream>
#include "include_base_utils.h"
#include "console_handler.h"
#include "p2p/net_node.h"
#include "cryptonote_basic/cryptonote_basic.h"
#include "cryptonote_basic/cryptonote_basic_impl.h"
#include "cryptonote_basic/cryptonote_format_utils.h"
#include "cryptonote_basic/miner.h"
#include "blockchain_db/blockchain_db.h"
#include "cryptonote_core/cryptonote_core.h"
#include "cryptonote_core/tx_pool.h"
#include "cryptonote_core/blockchain.h"
#include "blockchain_db/testdb.h"
#include "chaingen.h"
#include "device/device.hpp"
Include dependency graph for chaingen.cpp:

Functions

static std::unique_ptr< cryptonote::Blockchaininit_blockchain (const std::vector< test_event_entry > &events, cryptonote::network_type nettype)
bool init_output_indices (map_output_idx_t &outs, std::map< uint64_t, std::vector< size_t > > &outs_mine, const std::vector< cryptonote::block > &blockchain, const map_hash2tx_t &mtx, const cryptonote::account_base &from)
bool init_spent_output_indices (map_output_idx_t &outs, map_output_t &outs_mine, const std::vector< cryptonote::block > &blockchain, const map_hash2tx_t &mtx, const cryptonote::account_base &from)
bool fill_output_entries (std::vector< output_index > &out_indices, size_t sender_out, size_t nmix, size_t &real_entry_idx, std::vector< tx_source_entry::output_entry > &output_entries)
bool fill_tx_sources (std::vector< tx_source_entry > &sources, const std::vector< test_event_entry > &events, const block &blk_head, const cryptonote::account_base &from, uint64_t amount, size_t nmix)
bool fill_tx_destination (tx_destination_entry &de, const cryptonote::account_public_address &to, uint64_t amount)
std::string dump_data (const cryptonote::transaction &tx)
cryptonote::account_public_address get_address (const var_addr_t &inp)
cryptonote::account_public_address get_address (const cryptonote::account_public_address &inp)
cryptonote::account_public_address get_address (const cryptonote::account_keys &inp)
cryptonote::account_public_address get_address (const cryptonote::account_base &inp)
cryptonote::account_public_address get_address (const cryptonote::tx_destination_entry &inp)
uint64_t sum_amount (const std::vector< tx_destination_entry > &destinations)
uint64_t sum_amount (const std::vector< cryptonote::tx_source_entry > &sources)
void fill_tx_destinations (const var_addr_t &from, const std::vector< tx_destination_entry > &dests, uint64_t fee, const std::vector< tx_source_entry > &sources, std::vector< tx_destination_entry > &destinations, bool always_change)
void fill_tx_destinations (const var_addr_t &from, const cryptonote::account_public_address &to, uint64_t amount, uint64_t fee, const std::vector< tx_source_entry > &sources, std::vector< tx_destination_entry > &destinations, std::vector< tx_destination_entry > &destinations_pure, bool always_change)
void fill_tx_destinations (const var_addr_t &from, const cryptonote::account_public_address &to, uint64_t amount, uint64_t fee, const std::vector< tx_source_entry > &sources, std::vector< tx_destination_entry > &destinations, bool always_change)
void fill_tx_sources_and_destinations (const std::vector< test_event_entry > &events, const block &blk_head, const cryptonote::account_base &from, const cryptonote::account_public_address &to, uint64_t amount, uint64_t fee, size_t nmix, std::vector< tx_source_entry > &sources, std::vector< tx_destination_entry > &destinations)
void fill_tx_sources_and_destinations (const std::vector< test_event_entry > &events, const block &blk_head, const cryptonote::account_base &from, const cryptonote::account_base &to, uint64_t amount, uint64_t fee, size_t nmix, std::vector< tx_source_entry > &sources, std::vector< tx_destination_entry > &destinations)
cryptonote::tx_destination_entry build_dst (const var_addr_t &to, bool is_subaddr, uint64_t amount)
std::vector< cryptonote::tx_destination_entrybuild_dsts (const var_addr_t &to1, bool sub1, uint64_t am1)
std::vector< cryptonote::tx_destination_entrybuild_dsts (std::initializer_list< dest_wrapper_t > inps)
bool construct_miner_tx_manually (size_t height, uint64_t already_generated_coins, const account_public_address &miner_address, transaction &tx, uint64_t fee, uint8_t hf_version, keypair *p_txkey)
bool construct_tx_to_key (const std::vector< test_event_entry > &events, cryptonote::transaction &tx, const cryptonote::block &blk_head, const cryptonote::account_base &from, const var_addr_t &to, uint64_t amount, uint64_t fee, size_t nmix, bool rct, rct::RangeProofType range_proof_type, int bp_version)
bool construct_tx_to_key (const std::vector< test_event_entry > &events, cryptonote::transaction &tx, const cryptonote::block &blk_head, const cryptonote::account_base &from, std::vector< cryptonote::tx_destination_entry > destinations, uint64_t fee, size_t nmix, bool rct, rct::RangeProofType range_proof_type, int bp_version)
bool construct_tx_to_key (cryptonote::transaction &tx, const cryptonote::account_base &from, const var_addr_t &to, uint64_t amount, std::vector< cryptonote::tx_source_entry > &sources, uint64_t fee, bool rct, rct::RangeProofType range_proof_type, int bp_version)
bool construct_tx_to_key (cryptonote::transaction &tx, const cryptonote::account_base &from, const std::vector< cryptonote::tx_destination_entry > &destinations, std::vector< cryptonote::tx_source_entry > &sources, uint64_t fee, bool rct, rct::RangeProofType range_proof_type, int bp_version)
bool construct_tx_rct (const cryptonote::account_keys &sender_account_keys, std::vector< cryptonote::tx_source_entry > &sources, const std::vector< cryptonote::tx_destination_entry > &destinations, const boost::optional< cryptonote::account_public_address > &change_addr, std::vector< uint8_t > extra, cryptonote::transaction &tx, bool rct, rct::RangeProofType range_proof_type, int bp_version)
transaction construct_tx_with_fee (std::vector< test_event_entry > &events, const block &blk_head, const account_base &acc_from, const var_addr_t &to, uint64_t amount, uint64_t fee)
uint64_t get_balance (const cryptonote::account_base &addr, const std::vector< cryptonote::block > &blockchain, const map_hash2tx_t &mtx)
bool extract_hard_forks (const std::vector< test_event_entry > &events, v_hardforks_t &hard_forks)
bool extract_hard_forks_from_blocks (const std::vector< test_event_entry > &events, v_hardforks_t &hard_forks)
void get_confirmed_txs (const std::vector< cryptonote::block > &blockchain, const map_hash2tx_t &mtx, map_hash2tx_t &confirmed_txs)
bool trim_block_chain (std::vector< cryptonote::block > &blockchain, const crypto::hash &tail)
bool trim_block_chain (std::vector< const cryptonote::block * > &blockchain, const crypto::hash &tail)
uint64_t num_blocks (const std::vector< test_event_entry > &events)
cryptonote::block get_head_block (const std::vector< test_event_entry > &events)
bool find_block_chain (const std::vector< test_event_entry > &events, std::vector< cryptonote::block > &blockchain, map_hash2tx_t &mtx, const crypto::hash &head)
bool find_block_chain (const std::vector< test_event_entry > &events, std::vector< const cryptonote::block * > &blockchain, map_hash2tx_t &mtx, const crypto::hash &head)

Function Documentation

◆ build_dst()

cryptonote::tx_destination_entry build_dst ( const var_addr_t & to,
bool is_subaddr,
uint64_t amount )

◆ build_dsts() [1/2]

std::vector< cryptonote::tx_destination_entry > build_dsts ( const var_addr_t & to1,
bool sub1,
uint64_t am1 )

◆ build_dsts() [2/2]

std::vector< cryptonote::tx_destination_entry > build_dsts ( std::initializer_list< dest_wrapper_t > inps)

◆ construct_miner_tx_manually()

bool construct_miner_tx_manually ( size_t height,
uint64_t already_generated_coins,
const account_public_address & miner_address,
transaction & tx,
uint64_t fee,
uint8_t hf_version,
keypair * p_txkey )

◆ construct_tx_rct()

bool construct_tx_rct ( const cryptonote::account_keys & sender_account_keys,
std::vector< cryptonote::tx_source_entry > & sources,
const std::vector< cryptonote::tx_destination_entry > & destinations,
const boost::optional< cryptonote::account_public_address > & change_addr,
std::vector< uint8_t > extra,
cryptonote::transaction & tx,
bool rct,
rct::RangeProofType range_proof_type,
int bp_version )

◆ construct_tx_to_key() [1/4]

bool construct_tx_to_key ( const std::vector< test_event_entry > & events,
cryptonote::transaction & tx,
const cryptonote::block & blk_head,
const cryptonote::account_base & from,
const var_addr_t & to,
uint64_t amount,
uint64_t fee,
size_t nmix,
bool rct,
rct::RangeProofType range_proof_type,
int bp_version )

◆ construct_tx_to_key() [2/4]

bool construct_tx_to_key ( const std::vector< test_event_entry > & events,
cryptonote::transaction & tx,
const cryptonote::block & blk_head,
const cryptonote::account_base & from,
std::vector< cryptonote::tx_destination_entry > destinations,
uint64_t fee,
size_t nmix,
bool rct,
rct::RangeProofType range_proof_type,
int bp_version )

◆ construct_tx_to_key() [3/4]

bool construct_tx_to_key ( cryptonote::transaction & tx,
const cryptonote::account_base & from,
const std::vector< cryptonote::tx_destination_entry > & destinations,
std::vector< cryptonote::tx_source_entry > & sources,
uint64_t fee,
bool rct,
rct::RangeProofType range_proof_type,
int bp_version )

◆ construct_tx_to_key() [4/4]

bool construct_tx_to_key ( cryptonote::transaction & tx,
const cryptonote::account_base & from,
const var_addr_t & to,
uint64_t amount,
std::vector< cryptonote::tx_source_entry > & sources,
uint64_t fee,
bool rct,
rct::RangeProofType range_proof_type,
int bp_version )

◆ construct_tx_with_fee()

transaction construct_tx_with_fee ( std::vector< test_event_entry > & events,
const block & blk_head,
const account_base & acc_from,
const var_addr_t & to,
uint64_t amount,
uint64_t fee )

◆ dump_data()

std::string dump_data ( const cryptonote::transaction & tx)

◆ extract_hard_forks()

bool extract_hard_forks ( const std::vector< test_event_entry > & events,
v_hardforks_t & hard_forks )

◆ extract_hard_forks_from_blocks()

bool extract_hard_forks_from_blocks ( const std::vector< test_event_entry > & events,
v_hardforks_t & hard_forks )

◆ fill_output_entries()

bool fill_output_entries ( std::vector< output_index > & out_indices,
size_t sender_out,
size_t nmix,
size_t & real_entry_idx,
std::vector< tx_source_entry::output_entry > & output_entries )

◆ fill_tx_destination()

bool fill_tx_destination ( tx_destination_entry & de,
const cryptonote::account_public_address & to,
uint64_t amount )

◆ fill_tx_destinations() [1/3]

void fill_tx_destinations ( const var_addr_t & from,
const cryptonote::account_public_address & to,
uint64_t amount,
uint64_t fee,
const std::vector< tx_source_entry > & sources,
std::vector< tx_destination_entry > & destinations,
bool always_change )

◆ fill_tx_destinations() [2/3]

void fill_tx_destinations ( const var_addr_t & from,
const cryptonote::account_public_address & to,
uint64_t amount,
uint64_t fee,
const std::vector< tx_source_entry > & sources,
std::vector< tx_destination_entry > & destinations,
std::vector< tx_destination_entry > & destinations_pure,
bool always_change )

◆ fill_tx_destinations() [3/3]

void fill_tx_destinations ( const var_addr_t & from,
const std::vector< tx_destination_entry > & dests,
uint64_t fee,
const std::vector< tx_source_entry > & sources,
std::vector< tx_destination_entry > & destinations,
bool always_change )

◆ fill_tx_sources()

bool fill_tx_sources ( std::vector< tx_source_entry > & sources,
const std::vector< test_event_entry > & events,
const block & blk_head,
const cryptonote::account_base & from,
uint64_t amount,
size_t nmix )

◆ fill_tx_sources_and_destinations() [1/2]

void fill_tx_sources_and_destinations ( const std::vector< test_event_entry > & events,
const block & blk_head,
const cryptonote::account_base & from,
const cryptonote::account_base & to,
uint64_t amount,
uint64_t fee,
size_t nmix,
std::vector< tx_source_entry > & sources,
std::vector< tx_destination_entry > & destinations )

◆ fill_tx_sources_and_destinations() [2/2]

void fill_tx_sources_and_destinations ( const std::vector< test_event_entry > & events,
const block & blk_head,
const cryptonote::account_base & from,
const cryptonote::account_public_address & to,
uint64_t amount,
uint64_t fee,
size_t nmix,
std::vector< tx_source_entry > & sources,
std::vector< tx_destination_entry > & destinations )

◆ find_block_chain() [1/2]

bool find_block_chain ( const std::vector< test_event_entry > & events,
std::vector< const cryptonote::block * > & blockchain,
map_hash2tx_t & mtx,
const crypto::hash & head )

◆ find_block_chain() [2/2]

bool find_block_chain ( const std::vector< test_event_entry > & events,
std::vector< cryptonote::block > & blockchain,
map_hash2tx_t & mtx,
const crypto::hash & head )

◆ get_address() [1/5]

◆ get_address() [2/5]

◆ get_address() [3/5]

◆ get_address() [4/5]

◆ get_address() [5/5]

◆ get_balance()

uint64_t get_balance ( const cryptonote::account_base & addr,
const std::vector< cryptonote::block > & blockchain,
const map_hash2tx_t & mtx )

◆ get_confirmed_txs()

void get_confirmed_txs ( const std::vector< cryptonote::block > & blockchain,
const map_hash2tx_t & mtx,
map_hash2tx_t & confirmed_txs )

◆ get_head_block()

cryptonote::block get_head_block ( const std::vector< test_event_entry > & events)

◆ init_blockchain()

std::unique_ptr< cryptonote::Blockchain > init_blockchain ( const std::vector< test_event_entry > & events,
cryptonote::network_type nettype )
static

◆ init_output_indices()

bool init_output_indices ( map_output_idx_t & outs,
std::map< uint64_t, std::vector< size_t > > & outs_mine,
const std::vector< cryptonote::block > & blockchain,
const map_hash2tx_t & mtx,
const cryptonote::account_base & from )

◆ init_spent_output_indices()

bool init_spent_output_indices ( map_output_idx_t & outs,
map_output_t & outs_mine,
const std::vector< cryptonote::block > & blockchain,
const map_hash2tx_t & mtx,
const cryptonote::account_base & from )

◆ num_blocks()

uint64_t num_blocks ( const std::vector< test_event_entry > & events)

◆ sum_amount() [1/2]

uint64_t sum_amount ( const std::vector< cryptonote::tx_source_entry > & sources)

◆ sum_amount() [2/2]

uint64_t sum_amount ( const std::vector< tx_destination_entry > & destinations)

◆ trim_block_chain() [1/2]

bool trim_block_chain ( std::vector< const cryptonote::block * > & blockchain,
const crypto::hash & tail )

◆ trim_block_chain() [2/2]

bool trim_block_chain ( std::vector< cryptonote::block > & blockchain,
const crypto::hash & tail )