| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "chaingen.h" |
| 34 |
#include "wallet/wallet2.h" |
| 35 |
|
| 36 |
typedef struct { |
| 37 |
tools::wallet2::transfer_details * td; |
| 38 |
cryptonote::tx_source_entry * src; |
| 39 |
|
| 40 |
std::unordered_set<size_t> * selected_idx; |
| 41 |
std::unordered_set<crypto::key_image> * selected_kis; |
| 42 |
size_t ntrans; |
| 43 |
size_t iters; |
| 44 |
uint64_t sum; |
| 45 |
size_t cur_utxo; |
| 46 |
} tx_source_info_crate_t; |
| 47 |
|
| 48 |
typedef std::function<bool(const tx_source_info_crate_t &info, bool &abort)> fnc_accept_tx_source_t; |
| 49 |
|
| 50 |
|
| 51 |
class wallet_accessor_test |
| 52 |
{ |
| 53 |
public: |
| 54 |
static void set_account(tools::wallet2 * wallet, cryptonote::account_base& account); |
| 55 |
static tools::wallet2::transfer_container & get_transfers(tools::wallet2 * wallet) { return wallet->m_transfers; } |
| 56 |
static subaddresses_t & get_subaddresses(tools::wallet2 * wallet) { return wallet->m_subaddresses; } |
| 57 |
static void process_parsed_blocks(tools::wallet2 * wallet, uint64_t start_height, const std::vector<cryptonote::block_complete_entry> &blocks, const std::vector<tools::wallet2::parsed_block> &parsed_blocks, uint64_t& blocks_added); |
| 58 |
}; |
| 59 |
|
| 60 |
class wallet_tools |
| 61 |
{ |
| 62 |
public: |
| 63 |
static void gen_tx_src(size_t mixin, uint64_t cur_height, const tools::wallet2::transfer_details & td, cryptonote::tx_source_entry & src, block_tracker &bt); |
| 64 |
static void gen_block_data(block_tracker &bt, const cryptonote::block *bl, const map_hash2tx_t & mtx, cryptonote::block_complete_entry &bche, tools::wallet2::parsed_block &parsed_block, uint64_t &height); |
| 65 |
static void compute_subaddresses(std::unordered_map<crypto::public_key, cryptonote::subaddress_index> &subaddresses, cryptonote::account_base & creds, size_t account, size_t minors); |
| 66 |
static void process_transactions(tools::wallet2 * wallet, const std::vector<test_event_entry>& events, const cryptonote::block& blk_head, block_tracker &bt, const boost::optional<crypto::hash>& blk_tail=boost::none); |
| 67 |
static void process_transactions(tools::wallet2 * wallet, const std::vector<const cryptonote::block*>& blockchain, const map_hash2tx_t & mtx, block_tracker &bt); |
| 68 |
static bool fill_tx_sources(tools::wallet2 * wallet, std::vector<cryptonote::tx_source_entry>& sources, size_t mixin, const boost::optional<size_t>& num_utxo, const boost::optional<uint64_t>& min_amount, block_tracker &bt, std::vector<size_t> &selected, uint64_t cur_height, ssize_t offset=0, int step=1, const boost::optional<fnc_accept_tx_source_t>& fnc_accept=boost::none); |
| 69 |
}; |
| 70 |
|
| 71 |
cryptonote::account_public_address get_address(const tools::wallet2*); |
| 72 |
|
| 73 |
bool construct_tx_to_key(cryptonote::transaction& tx, tools::wallet2 * from_wallet, const var_addr_t& to, uint64_t amount, |
| 74 |
std::vector<cryptonote::tx_source_entry> &sources, |
| 75 |
uint64_t fee, bool rct=false, rct::RangeProofType range_proof_type=rct::RangeProofBorromean, int bp_version = 0); |
| 76 |
|
| 77 |
bool construct_tx_to_key(cryptonote::transaction& tx, tools::wallet2 * sender_wallet, const std::vector<cryptonote::tx_destination_entry>& destinations, |
| 78 |
std::vector<cryptonote::tx_source_entry> &sources, |
| 79 |
uint64_t fee, bool rct, rct::RangeProofType range_proof_type, int bp_version = 0); |
| 80 |
|
| 81 |
bool construct_tx_rct(tools::wallet2 * sender_wallet, |
| 82 |
std::vector<cryptonote::tx_source_entry>& sources, |
| 83 |
const std::vector<cryptonote::tx_destination_entry>& destinations, |
| 84 |
const boost::optional<cryptonote::account_public_address>& change_addr, |
| 85 |
std::vector<uint8_t> extra, cryptonote::transaction& tx, |
| 86 |
bool rct=false, rct::RangeProofType range_proof_type=rct::RangeProofBorromean, int bp_version = 0); |