mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Merge pull request #3141
3160a930
wallet2: remove {set|get}_default_decimal_point and use the same funcs under cryptonote:: instead (stoffu)7d1088d3
wallet2: make scan_output const and omit keys arg (stoffu)bc1ee2c2
wallet2: make member functions const when possible (stoffu)
This commit is contained in:
commit
5603d5aaea
3 changed files with 43 additions and 55 deletions
|
@ -1403,7 +1403,7 @@ bool simple_wallet::set_unit(const std::vector<std::string> &args/* = std::vecto
|
||||||
const auto pwd_container = get_and_verify_password();
|
const auto pwd_container = get_and_verify_password();
|
||||||
if (pwd_container)
|
if (pwd_container)
|
||||||
{
|
{
|
||||||
m_wallet->set_default_decimal_point(decimal_point);
|
cryptonote::set_default_decimal_point(decimal_point);
|
||||||
m_wallet->rewrite(m_wallet_file, pwd_container->password());
|
m_wallet->rewrite(m_wallet_file, pwd_container->password());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -1850,7 +1850,7 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args)
|
||||||
success_msg_writer() << "priority = " << m_wallet->get_default_priority();
|
success_msg_writer() << "priority = " << m_wallet->get_default_priority();
|
||||||
success_msg_writer() << "confirm-missing-payment-id = " << m_wallet->confirm_missing_payment_id();
|
success_msg_writer() << "confirm-missing-payment-id = " << m_wallet->confirm_missing_payment_id();
|
||||||
success_msg_writer() << "ask-password = " << m_wallet->ask_password();
|
success_msg_writer() << "ask-password = " << m_wallet->ask_password();
|
||||||
success_msg_writer() << "unit = " << cryptonote::get_unit(m_wallet->get_default_decimal_point());
|
success_msg_writer() << "unit = " << cryptonote::get_unit(cryptonote::get_default_decimal_point());
|
||||||
success_msg_writer() << "min-outputs-count = " << m_wallet->get_min_output_count();
|
success_msg_writer() << "min-outputs-count = " << m_wallet->get_min_output_count();
|
||||||
success_msg_writer() << "min-outputs-value = " << cryptonote::print_money(m_wallet->get_min_output_value());
|
success_msg_writer() << "min-outputs-value = " << cryptonote::print_money(m_wallet->get_min_output_value());
|
||||||
success_msg_writer() << "merge-destinations = " << m_wallet->merge_destinations();
|
success_msg_writer() << "merge-destinations = " << m_wallet->merge_destinations();
|
||||||
|
|
|
@ -1011,7 +1011,7 @@ static uint64_t decodeRct(const rct::rctSig & rv, const crypto::key_derivation &
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
void wallet2::scan_output(const cryptonote::account_keys &keys, const cryptonote::transaction &tx, const crypto::public_key &tx_pub_key, size_t i, tx_scan_info_t &tx_scan_info, int &num_vouts_received, std::unordered_map<cryptonote::subaddress_index, uint64_t> &tx_money_got_in_outs, std::vector<size_t> &outs)
|
void wallet2::scan_output(const cryptonote::transaction &tx, const crypto::public_key &tx_pub_key, size_t i, tx_scan_info_t &tx_scan_info, int &num_vouts_received, std::unordered_map<cryptonote::subaddress_index, uint64_t> &tx_money_got_in_outs, std::vector<size_t> &outs) const
|
||||||
{
|
{
|
||||||
THROW_WALLET_EXCEPTION_IF(i >= tx.vout.size(), error::wallet_internal_error, "Invalid vout index");
|
THROW_WALLET_EXCEPTION_IF(i >= tx.vout.size(), error::wallet_internal_error, "Invalid vout index");
|
||||||
if (m_multisig)
|
if (m_multisig)
|
||||||
|
@ -1022,7 +1022,7 @@ void wallet2::scan_output(const cryptonote::account_keys &keys, const cryptonote
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool r = cryptonote::generate_key_image_helper_precomp(keys, boost::get<cryptonote::txout_to_key>(tx.vout[i].target).key, tx_scan_info.received->derivation, i, tx_scan_info.received->index, tx_scan_info.in_ephemeral, tx_scan_info.ki);
|
bool r = cryptonote::generate_key_image_helper_precomp(m_account.get_keys(), boost::get<cryptonote::txout_to_key>(tx.vout[i].target).key, tx_scan_info.received->derivation, i, tx_scan_info.received->index, tx_scan_info.in_ephemeral, tx_scan_info.ki);
|
||||||
THROW_WALLET_EXCEPTION_IF(!r, error::wallet_internal_error, "Failed to generate key image");
|
THROW_WALLET_EXCEPTION_IF(!r, error::wallet_internal_error, "Failed to generate key image");
|
||||||
THROW_WALLET_EXCEPTION_IF(tx_scan_info.in_ephemeral.pub != boost::get<cryptonote::txout_to_key>(tx.vout[i].target).key,
|
THROW_WALLET_EXCEPTION_IF(tx_scan_info.in_ephemeral.pub != boost::get<cryptonote::txout_to_key>(tx.vout[i].target).key,
|
||||||
error::wallet_internal_error, "key_image generated ephemeral public key not matched with output_key");
|
error::wallet_internal_error, "key_image generated ephemeral public key not matched with output_key");
|
||||||
|
@ -1127,7 +1127,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
|
||||||
THROW_WALLET_EXCEPTION_IF(tx_scan_info[i].error, error::acc_outs_lookup_error, tx, tx_pub_key, m_account.get_keys());
|
THROW_WALLET_EXCEPTION_IF(tx_scan_info[i].error, error::acc_outs_lookup_error, tx, tx_pub_key, m_account.get_keys());
|
||||||
if (tx_scan_info[i].received)
|
if (tx_scan_info[i].received)
|
||||||
{
|
{
|
||||||
scan_output(keys, tx, tx_pub_key, i, tx_scan_info[i], num_vouts_received, tx_money_got_in_outs, outs);
|
scan_output(tx, tx_pub_key, i, tx_scan_info[i], num_vouts_received, tx_money_got_in_outs, outs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1145,7 +1145,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
|
||||||
THROW_WALLET_EXCEPTION_IF(tx_scan_info[i].error, error::acc_outs_lookup_error, tx, tx_pub_key, m_account.get_keys());
|
THROW_WALLET_EXCEPTION_IF(tx_scan_info[i].error, error::acc_outs_lookup_error, tx, tx_pub_key, m_account.get_keys());
|
||||||
if (tx_scan_info[i].received)
|
if (tx_scan_info[i].received)
|
||||||
{
|
{
|
||||||
scan_output(keys, tx, tx_pub_key, i, tx_scan_info[i], num_vouts_received, tx_money_got_in_outs, outs);
|
scan_output(tx, tx_pub_key, i, tx_scan_info[i], num_vouts_received, tx_money_got_in_outs, outs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1157,7 +1157,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
|
||||||
THROW_WALLET_EXCEPTION_IF(tx_scan_info[i].error, error::acc_outs_lookup_error, tx, tx_pub_key, m_account.get_keys());
|
THROW_WALLET_EXCEPTION_IF(tx_scan_info[i].error, error::acc_outs_lookup_error, tx, tx_pub_key, m_account.get_keys());
|
||||||
if (tx_scan_info[i].received)
|
if (tx_scan_info[i].received)
|
||||||
{
|
{
|
||||||
scan_output(keys, tx, tx_pub_key, i, tx_scan_info[i], num_vouts_received, tx_money_got_in_outs, outs);
|
scan_output(tx, tx_pub_key, i, tx_scan_info[i], num_vouts_received, tx_money_got_in_outs, outs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3419,16 +3419,6 @@ bool wallet2::parse_payment_id(const std::string& payment_id_str, crypto::hash&
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
void wallet2::set_default_decimal_point(unsigned int decimal_point)
|
|
||||||
{
|
|
||||||
cryptonote::set_default_decimal_point(decimal_point);
|
|
||||||
}
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
|
||||||
unsigned int wallet2::get_default_decimal_point() const
|
|
||||||
{
|
|
||||||
return cryptonote::get_default_decimal_point();
|
|
||||||
}
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
|
||||||
bool wallet2::prepare_file_names(const std::string& file_path)
|
bool wallet2::prepare_file_names(const std::string& file_path)
|
||||||
{
|
{
|
||||||
do_prepare_file_names(file_path, m_keys_file, m_wallet_file);
|
do_prepare_file_names(file_path, m_keys_file, m_wallet_file);
|
||||||
|
@ -4144,7 +4134,7 @@ size_t wallet2::pop_best_value(std::vector<size_t> &unused_indices, const std::v
|
||||||
// returns:
|
// returns:
|
||||||
// direct return: amount of money found
|
// direct return: amount of money found
|
||||||
// modified reference: selected_transfers, a list of iterators/indices of input sources
|
// modified reference: selected_transfers, a list of iterators/indices of input sources
|
||||||
uint64_t wallet2::select_transfers(uint64_t needed_money, std::vector<size_t> unused_transfers_indices, std::vector<size_t>& selected_transfers, bool trusted_daemon)
|
uint64_t wallet2::select_transfers(uint64_t needed_money, std::vector<size_t> unused_transfers_indices, std::vector<size_t>& selected_transfers, bool trusted_daemon) const
|
||||||
{
|
{
|
||||||
uint64_t found_money = 0;
|
uint64_t found_money = 0;
|
||||||
selected_transfers.reserve(unused_transfers_indices.size());
|
selected_transfers.reserve(unused_transfers_indices.size());
|
||||||
|
@ -4152,7 +4142,7 @@ uint64_t wallet2::select_transfers(uint64_t needed_money, std::vector<size_t> un
|
||||||
{
|
{
|
||||||
size_t idx = pop_best_value(unused_transfers_indices, selected_transfers);
|
size_t idx = pop_best_value(unused_transfers_indices, selected_transfers);
|
||||||
|
|
||||||
transfer_container::iterator it = m_transfers.begin() + idx;
|
const transfer_container::const_iterator it = m_transfers.begin() + idx;
|
||||||
selected_transfers.push_back(idx);
|
selected_transfers.push_back(idx);
|
||||||
found_money += it->amount();
|
found_money += it->amount();
|
||||||
}
|
}
|
||||||
|
@ -4359,7 +4349,7 @@ void wallet2::commit_tx(std::vector<pending_tx>& ptx_vector)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
bool wallet2::save_tx(const std::vector<pending_tx>& ptx_vector, const std::string &filename)
|
bool wallet2::save_tx(const std::vector<pending_tx>& ptx_vector, const std::string &filename) const
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("saving " << ptx_vector.size() << " transactions");
|
LOG_PRINT_L0("saving " << ptx_vector.size() << " transactions");
|
||||||
unsigned_tx_set txs;
|
unsigned_tx_set txs;
|
||||||
|
@ -4388,7 +4378,7 @@ bool wallet2::save_tx(const std::vector<pending_tx>& ptx_vector, const std::stri
|
||||||
return epee::file_io_utils::save_string_to_file(filename, std::string(UNSIGNED_TX_PREFIX) + ciphertext);
|
return epee::file_io_utils::save_string_to_file(filename, std::string(UNSIGNED_TX_PREFIX) + ciphertext);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
bool wallet2::load_unsigned_tx(const std::string &unsigned_filename, unsigned_tx_set &exported_txs)
|
bool wallet2::load_unsigned_tx(const std::string &unsigned_filename, unsigned_tx_set &exported_txs) const
|
||||||
{
|
{
|
||||||
std::string s;
|
std::string s;
|
||||||
boost::system::error_code errcode;
|
boost::system::error_code errcode;
|
||||||
|
@ -4962,7 +4952,7 @@ bool wallet2::sign_multisig_tx_from_file(const std::string &filename, std::vecto
|
||||||
return sign_multisig_tx_to_file(exported_txs, filename, txids);
|
return sign_multisig_tx_to_file(exported_txs, filename, txids);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
uint64_t wallet2::get_fee_multiplier(uint32_t priority, int fee_algorithm)
|
uint64_t wallet2::get_fee_multiplier(uint32_t priority, int fee_algorithm) const
|
||||||
{
|
{
|
||||||
static const uint64_t old_multipliers[3] = {1, 2, 3};
|
static const uint64_t old_multipliers[3] = {1, 2, 3};
|
||||||
static const uint64_t new_multipliers[3] = {1, 20, 166};
|
static const uint64_t new_multipliers[3] = {1, 20, 166};
|
||||||
|
@ -4999,7 +4989,7 @@ uint64_t wallet2::get_fee_multiplier(uint32_t priority, int fee_algorithm)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
uint64_t wallet2::get_dynamic_per_kb_fee_estimate()
|
uint64_t wallet2::get_dynamic_per_kb_fee_estimate() const
|
||||||
{
|
{
|
||||||
uint64_t fee;
|
uint64_t fee;
|
||||||
boost::optional<std::string> result = m_node_rpc_proxy.get_dynamic_per_kb_fee_estimate(FEE_ESTIMATE_GRACE_BLOCKS, fee);
|
boost::optional<std::string> result = m_node_rpc_proxy.get_dynamic_per_kb_fee_estimate(FEE_ESTIMATE_GRACE_BLOCKS, fee);
|
||||||
|
@ -5009,7 +4999,7 @@ uint64_t wallet2::get_dynamic_per_kb_fee_estimate()
|
||||||
return FEE_PER_KB;
|
return FEE_PER_KB;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
uint64_t wallet2::get_per_kb_fee()
|
uint64_t wallet2::get_per_kb_fee() const
|
||||||
{
|
{
|
||||||
if(m_light_wallet)
|
if(m_light_wallet)
|
||||||
return m_light_wallet_per_kb_fee;
|
return m_light_wallet_per_kb_fee;
|
||||||
|
@ -5020,7 +5010,7 @@ uint64_t wallet2::get_per_kb_fee()
|
||||||
return get_dynamic_per_kb_fee_estimate();
|
return get_dynamic_per_kb_fee_estimate();
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
int wallet2::get_fee_algorithm()
|
int wallet2::get_fee_algorithm() const
|
||||||
{
|
{
|
||||||
// changes at v3 and v5
|
// changes at v3 and v5
|
||||||
if (use_fork_rules(5, 0))
|
if (use_fork_rules(5, 0))
|
||||||
|
@ -5030,7 +5020,7 @@ int wallet2::get_fee_algorithm()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
uint64_t wallet2::adjust_mixin(uint64_t mixin)
|
uint64_t wallet2::adjust_mixin(uint64_t mixin) const
|
||||||
{
|
{
|
||||||
if (mixin < 4 && use_fork_rules(6, 10)) {
|
if (mixin < 4 && use_fork_rules(6, 10)) {
|
||||||
MWARNING("Requested ring size " << (mixin + 1) << " too low for hard fork 6, using 5");
|
MWARNING("Requested ring size " << (mixin + 1) << " too low for hard fork 6, using 5");
|
||||||
|
@ -7189,13 +7179,13 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_from(const crypton
|
||||||
return ptx_vector;
|
return ptx_vector;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
void wallet2::get_hard_fork_info(uint8_t version, uint64_t &earliest_height)
|
void wallet2::get_hard_fork_info(uint8_t version, uint64_t &earliest_height) const
|
||||||
{
|
{
|
||||||
boost::optional<std::string> result = m_node_rpc_proxy.get_earliest_height(version, earliest_height);
|
boost::optional<std::string> result = m_node_rpc_proxy.get_earliest_height(version, earliest_height);
|
||||||
throw_on_rpc_response_error(result, "get_hard_fork_info");
|
throw_on_rpc_response_error(result, "get_hard_fork_info");
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
bool wallet2::use_fork_rules(uint8_t version, int64_t early_blocks)
|
bool wallet2::use_fork_rules(uint8_t version, int64_t early_blocks) const
|
||||||
{
|
{
|
||||||
// TODO: How to get fork rule info from light wallet node?
|
// TODO: How to get fork rule info from light wallet node?
|
||||||
if(m_light_wallet)
|
if(m_light_wallet)
|
||||||
|
@ -7214,7 +7204,7 @@ bool wallet2::use_fork_rules(uint8_t version, int64_t early_blocks)
|
||||||
return close_enough;
|
return close_enough;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
uint64_t wallet2::get_upper_transaction_size_limit()
|
uint64_t wallet2::get_upper_transaction_size_limit() const
|
||||||
{
|
{
|
||||||
if (m_upper_transaction_size_limit > 0)
|
if (m_upper_transaction_size_limit > 0)
|
||||||
return m_upper_transaction_size_limit;
|
return m_upper_transaction_size_limit;
|
||||||
|
@ -7222,7 +7212,7 @@ uint64_t wallet2::get_upper_transaction_size_limit()
|
||||||
return full_reward_zone - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE;
|
return full_reward_zone - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
std::vector<size_t> wallet2::select_available_outputs(const std::function<bool(const transfer_details &td)> &f)
|
std::vector<size_t> wallet2::select_available_outputs(const std::function<bool(const transfer_details &td)> &f) const
|
||||||
{
|
{
|
||||||
std::vector<size_t> outputs;
|
std::vector<size_t> outputs;
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
|
@ -7240,7 +7230,7 @@ std::vector<size_t> wallet2::select_available_outputs(const std::function<bool(c
|
||||||
return outputs;
|
return outputs;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
std::vector<uint64_t> wallet2::get_unspent_amounts_vector()
|
std::vector<uint64_t> wallet2::get_unspent_amounts_vector() const
|
||||||
{
|
{
|
||||||
std::set<uint64_t> set;
|
std::set<uint64_t> set;
|
||||||
for (const auto &td: m_transfers)
|
for (const auto &td: m_transfers)
|
||||||
|
@ -8215,7 +8205,7 @@ std::string wallet2::get_daemon_address() const
|
||||||
return m_daemon_address;
|
return m_daemon_address;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t wallet2::get_daemon_blockchain_height(string &err)
|
uint64_t wallet2::get_daemon_blockchain_height(string &err) const
|
||||||
{
|
{
|
||||||
uint64_t height;
|
uint64_t height;
|
||||||
|
|
||||||
|
@ -8445,7 +8435,7 @@ crypto::public_key wallet2::get_tx_pub_key_from_received_outs(const tools::walle
|
||||||
return crypto::null_pkey;
|
return crypto::null_pkey;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wallet2::export_key_images(const std::string &filename)
|
bool wallet2::export_key_images(const std::string &filename) const
|
||||||
{
|
{
|
||||||
std::vector<std::pair<crypto::key_image, crypto::signature>> ski = export_key_images();
|
std::vector<std::pair<crypto::key_image, crypto::signature>> ski = export_key_images();
|
||||||
std::string magic(KEY_IMAGE_EXPORT_FILE_MAGIC, strlen(KEY_IMAGE_EXPORT_FILE_MAGIC));
|
std::string magic(KEY_IMAGE_EXPORT_FILE_MAGIC, strlen(KEY_IMAGE_EXPORT_FILE_MAGIC));
|
||||||
|
@ -9249,7 +9239,7 @@ std::string wallet2::decrypt_with_view_secret_key(const std::string &ciphertext,
|
||||||
return decrypt(ciphertext, get_account().get_keys().m_view_secret_key, authenticated);
|
return decrypt(ciphertext, get_account().get_keys().m_view_secret_key, authenticated);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
std::string wallet2::make_uri(const std::string &address, const std::string &payment_id, uint64_t amount, const std::string &tx_description, const std::string &recipient_name, std::string &error)
|
std::string wallet2::make_uri(const std::string &address, const std::string &payment_id, uint64_t amount, const std::string &tx_description, const std::string &recipient_name, std::string &error) const
|
||||||
{
|
{
|
||||||
cryptonote::address_parse_info info;
|
cryptonote::address_parse_info info;
|
||||||
if(!get_account_address_from_str(info, testnet(), address))
|
if(!get_account_address_from_str(info, testnet(), address))
|
||||||
|
@ -9547,7 +9537,7 @@ std::vector<std::pair<uint64_t, uint64_t>> wallet2::estimate_backlog(uint64_t mi
|
||||||
return blocks;
|
return blocks;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
void wallet2::generate_genesis(cryptonote::block& b) {
|
void wallet2::generate_genesis(cryptonote::block& b) const {
|
||||||
if (m_testnet)
|
if (m_testnet)
|
||||||
{
|
{
|
||||||
cryptonote::generate_genesis_block(b, config::testnet::GENESIS_TX, config::testnet::GENESIS_NONCE);
|
cryptonote::generate_genesis_block(b, config::testnet::GENESIS_TX, config::testnet::GENESIS_NONCE);
|
||||||
|
|
|
@ -657,7 +657,7 @@ namespace tools
|
||||||
|
|
||||||
void commit_tx(pending_tx& ptx_vector);
|
void commit_tx(pending_tx& ptx_vector);
|
||||||
void commit_tx(std::vector<pending_tx>& ptx_vector);
|
void commit_tx(std::vector<pending_tx>& ptx_vector);
|
||||||
bool save_tx(const std::vector<pending_tx>& ptx_vector, const std::string &filename);
|
bool save_tx(const std::vector<pending_tx>& ptx_vector, const std::string &filename) const;
|
||||||
std::string save_multisig_tx(multisig_tx_set txs);
|
std::string save_multisig_tx(multisig_tx_set txs);
|
||||||
bool save_multisig_tx(const multisig_tx_set &txs, const std::string &filename);
|
bool save_multisig_tx(const multisig_tx_set &txs, const std::string &filename);
|
||||||
std::string save_multisig_tx(const std::vector<pending_tx>& ptx_vector);
|
std::string save_multisig_tx(const std::vector<pending_tx>& ptx_vector);
|
||||||
|
@ -667,7 +667,7 @@ namespace tools
|
||||||
// sign unsigned tx. Takes unsigned_tx_set as argument. Used by GUI
|
// sign unsigned tx. Takes unsigned_tx_set as argument. Used by GUI
|
||||||
bool sign_tx(unsigned_tx_set &exported_txs, const std::string &signed_filename, std::vector<wallet2::pending_tx> &ptx, bool export_raw = false);
|
bool sign_tx(unsigned_tx_set &exported_txs, const std::string &signed_filename, std::vector<wallet2::pending_tx> &ptx, bool export_raw = false);
|
||||||
// load unsigned_tx_set from file.
|
// load unsigned_tx_set from file.
|
||||||
bool load_unsigned_tx(const std::string &unsigned_filename, unsigned_tx_set &exported_txs);
|
bool load_unsigned_tx(const std::string &unsigned_filename, unsigned_tx_set &exported_txs) const;
|
||||||
bool load_tx(const std::string &signed_filename, std::vector<tools::wallet2::pending_tx> &ptx, std::function<bool(const signed_tx_set&)> accept_func = NULL);
|
bool load_tx(const std::string &signed_filename, std::vector<tools::wallet2::pending_tx> &ptx, std::function<bool(const signed_tx_set&)> accept_func = NULL);
|
||||||
std::vector<pending_tx> create_transactions(std::vector<cryptonote::tx_destination_entry> dsts, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, bool trusted_daemon);
|
std::vector<pending_tx> create_transactions(std::vector<cryptonote::tx_destination_entry> dsts, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, bool trusted_daemon);
|
||||||
std::vector<wallet2::pending_tx> create_transactions_2(std::vector<cryptonote::tx_destination_entry> dsts, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, bool trusted_daemon); // pass subaddr_indices by value on purpose
|
std::vector<wallet2::pending_tx> create_transactions_2(std::vector<cryptonote::tx_destination_entry> dsts, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, bool trusted_daemon); // pass subaddr_indices by value on purpose
|
||||||
|
@ -826,8 +826,6 @@ namespace tools
|
||||||
void confirm_missing_payment_id(bool always) { m_confirm_missing_payment_id = always; }
|
void confirm_missing_payment_id(bool always) { m_confirm_missing_payment_id = always; }
|
||||||
bool ask_password() const { return m_ask_password; }
|
bool ask_password() const { return m_ask_password; }
|
||||||
void ask_password(bool always) { m_ask_password = always; }
|
void ask_password(bool always) { m_ask_password = always; }
|
||||||
void set_default_decimal_point(unsigned int decimal_point);
|
|
||||||
unsigned int get_default_decimal_point() const;
|
|
||||||
void set_min_output_count(uint32_t count) { m_min_output_count = count; }
|
void set_min_output_count(uint32_t count) { m_min_output_count = count; }
|
||||||
uint32_t get_min_output_count() const { return m_min_output_count; }
|
uint32_t get_min_output_count() const { return m_min_output_count; }
|
||||||
void set_min_output_value(uint64_t value) { m_min_output_value = value; }
|
void set_min_output_value(uint64_t value) { m_min_output_value = value; }
|
||||||
|
@ -880,15 +878,15 @@ namespace tools
|
||||||
size_t get_num_transfer_details() const { return m_transfers.size(); }
|
size_t get_num_transfer_details() const { return m_transfers.size(); }
|
||||||
const transfer_details &get_transfer_details(size_t idx) const;
|
const transfer_details &get_transfer_details(size_t idx) const;
|
||||||
|
|
||||||
void get_hard_fork_info(uint8_t version, uint64_t &earliest_height);
|
void get_hard_fork_info(uint8_t version, uint64_t &earliest_height) const;
|
||||||
bool use_fork_rules(uint8_t version, int64_t early_blocks = 0);
|
bool use_fork_rules(uint8_t version, int64_t early_blocks = 0) const;
|
||||||
int get_fee_algorithm();
|
int get_fee_algorithm() const;
|
||||||
|
|
||||||
std::string get_wallet_file() const;
|
std::string get_wallet_file() const;
|
||||||
std::string get_keys_file() const;
|
std::string get_keys_file() const;
|
||||||
std::string get_daemon_address() const;
|
std::string get_daemon_address() const;
|
||||||
const boost::optional<epee::net_utils::http::login>& get_daemon_login() const { return m_daemon_login; }
|
const boost::optional<epee::net_utils::http::login>& get_daemon_login() const { return m_daemon_login; }
|
||||||
uint64_t get_daemon_blockchain_height(std::string& err);
|
uint64_t get_daemon_blockchain_height(std::string& err) const;
|
||||||
uint64_t get_daemon_blockchain_target_height(std::string& err);
|
uint64_t get_daemon_blockchain_target_height(std::string& err);
|
||||||
/*!
|
/*!
|
||||||
* \brief Calculates the approximate blockchain height from current date/time.
|
* \brief Calculates the approximate blockchain height from current date/time.
|
||||||
|
@ -896,7 +894,7 @@ namespace tools
|
||||||
uint64_t get_approximate_blockchain_height() const;
|
uint64_t get_approximate_blockchain_height() const;
|
||||||
uint64_t estimate_blockchain_height();
|
uint64_t estimate_blockchain_height();
|
||||||
std::vector<size_t> select_available_outputs_from_histogram(uint64_t count, bool atleast, bool unlocked, bool allow_rct, bool trusted_daemon);
|
std::vector<size_t> select_available_outputs_from_histogram(uint64_t count, bool atleast, bool unlocked, bool allow_rct, bool trusted_daemon);
|
||||||
std::vector<size_t> select_available_outputs(const std::function<bool(const transfer_details &td)> &f);
|
std::vector<size_t> select_available_outputs(const std::function<bool(const transfer_details &td)> &f) const;
|
||||||
std::vector<size_t> select_available_unmixable_outputs(bool trusted_daemon);
|
std::vector<size_t> select_available_unmixable_outputs(bool trusted_daemon);
|
||||||
std::vector<size_t> select_available_mixable_outputs(bool trusted_daemon);
|
std::vector<size_t> select_available_mixable_outputs(bool trusted_daemon);
|
||||||
|
|
||||||
|
@ -938,7 +936,7 @@ namespace tools
|
||||||
void import_payments_out(const std::list<std::pair<crypto::hash,wallet2::confirmed_transfer_details>> &confirmed_payments);
|
void import_payments_out(const std::list<std::pair<crypto::hash,wallet2::confirmed_transfer_details>> &confirmed_payments);
|
||||||
std::tuple<size_t, crypto::hash, std::vector<crypto::hash>> export_blockchain() const;
|
std::tuple<size_t, crypto::hash, std::vector<crypto::hash>> export_blockchain() const;
|
||||||
void import_blockchain(const std::tuple<size_t, crypto::hash, std::vector<crypto::hash>> &bc);
|
void import_blockchain(const std::tuple<size_t, crypto::hash, std::vector<crypto::hash>> &bc);
|
||||||
bool export_key_images(const std::string &filename);
|
bool export_key_images(const std::string &filename) const;
|
||||||
std::vector<std::pair<crypto::key_image, crypto::signature>> export_key_images() const;
|
std::vector<std::pair<crypto::key_image, crypto::signature>> export_key_images() const;
|
||||||
uint64_t import_key_images(const std::vector<std::pair<crypto::key_image, crypto::signature>> &signed_key_images, uint64_t &spent, uint64_t &unspent, bool check_spent = true);
|
uint64_t import_key_images(const std::vector<std::pair<crypto::key_image, crypto::signature>> &signed_key_images, uint64_t &spent, uint64_t &unspent, bool check_spent = true);
|
||||||
uint64_t import_key_images(const std::string &filename, uint64_t &spent, uint64_t &unspent);
|
uint64_t import_key_images(const std::string &filename, uint64_t &spent, uint64_t &unspent);
|
||||||
|
@ -951,7 +949,7 @@ namespace tools
|
||||||
std::string decrypt(const std::string &ciphertext, const crypto::secret_key &skey, bool authenticated = true) const;
|
std::string decrypt(const std::string &ciphertext, const crypto::secret_key &skey, bool authenticated = true) const;
|
||||||
std::string decrypt_with_view_secret_key(const std::string &ciphertext, bool authenticated = true) const;
|
std::string decrypt_with_view_secret_key(const std::string &ciphertext, bool authenticated = true) const;
|
||||||
|
|
||||||
std::string make_uri(const std::string &address, const std::string &payment_id, uint64_t amount, const std::string &tx_description, const std::string &recipient_name, std::string &error);
|
std::string make_uri(const std::string &address, const std::string &payment_id, uint64_t amount, const std::string &tx_description, const std::string &recipient_name, std::string &error) const;
|
||||||
bool parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector<std::string> &unknown_parameters, std::string &error);
|
bool parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector<std::string> &unknown_parameters, std::string &error);
|
||||||
|
|
||||||
uint64_t get_blockchain_height_by_date(uint16_t year, uint8_t month, uint8_t day); // 1<=month<=12, 1<=day<=31
|
uint64_t get_blockchain_height_by_date(uint16_t year, uint8_t month, uint8_t day); // 1<=month<=12, 1<=day<=31
|
||||||
|
@ -960,9 +958,9 @@ namespace tools
|
||||||
|
|
||||||
std::vector<std::pair<uint64_t, uint64_t>> estimate_backlog(uint64_t min_blob_size, uint64_t max_blob_size, const std::vector<uint64_t> &fees);
|
std::vector<std::pair<uint64_t, uint64_t>> estimate_backlog(uint64_t min_blob_size, uint64_t max_blob_size, const std::vector<uint64_t> &fees);
|
||||||
|
|
||||||
uint64_t get_fee_multiplier(uint32_t priority, int fee_algorithm = -1);
|
uint64_t get_fee_multiplier(uint32_t priority, int fee_algorithm = -1) const;
|
||||||
uint64_t get_per_kb_fee();
|
uint64_t get_per_kb_fee() const;
|
||||||
uint64_t adjust_mixin(uint64_t mixin);
|
uint64_t adjust_mixin(uint64_t mixin) const;
|
||||||
|
|
||||||
// Light wallet specific functions
|
// Light wallet specific functions
|
||||||
// fetch unspent outs from lw node and store in m_transfers
|
// fetch unspent outs from lw node and store in m_transfers
|
||||||
|
@ -1032,20 +1030,20 @@ namespace tools
|
||||||
void fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history);
|
void fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history);
|
||||||
void pull_next_blocks(uint64_t start_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, const std::list<cryptonote::block_complete_entry> &prev_blocks, std::list<cryptonote::block_complete_entry> &blocks, std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> &o_indices, bool &error);
|
void pull_next_blocks(uint64_t start_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, const std::list<cryptonote::block_complete_entry> &prev_blocks, std::list<cryptonote::block_complete_entry> &blocks, std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> &o_indices, bool &error);
|
||||||
void process_blocks(uint64_t start_height, const std::list<cryptonote::block_complete_entry> &blocks, const std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> &o_indices, uint64_t& blocks_added);
|
void process_blocks(uint64_t start_height, const std::list<cryptonote::block_complete_entry> &blocks, const std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> &o_indices, uint64_t& blocks_added);
|
||||||
uint64_t select_transfers(uint64_t needed_money, std::vector<size_t> unused_transfers_indices, std::vector<size_t>& selected_transfers, bool trusted_daemon);
|
uint64_t select_transfers(uint64_t needed_money, std::vector<size_t> unused_transfers_indices, std::vector<size_t>& selected_transfers, bool trusted_daemon) const;
|
||||||
bool prepare_file_names(const std::string& file_path);
|
bool prepare_file_names(const std::string& file_path);
|
||||||
void process_unconfirmed(const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t height);
|
void process_unconfirmed(const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t height);
|
||||||
void process_outgoing(const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t height, uint64_t ts, uint64_t spent, uint64_t received, uint32_t subaddr_account, const std::set<uint32_t>& subaddr_indices);
|
void process_outgoing(const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t height, uint64_t ts, uint64_t spent, uint64_t received, uint32_t subaddr_account, const std::set<uint32_t>& subaddr_indices);
|
||||||
void add_unconfirmed_tx(const cryptonote::transaction& tx, uint64_t amount_in, const std::vector<cryptonote::tx_destination_entry> &dests, const crypto::hash &payment_id, uint64_t change_amount, uint32_t subaddr_account, const std::set<uint32_t>& subaddr_indices);
|
void add_unconfirmed_tx(const cryptonote::transaction& tx, uint64_t amount_in, const std::vector<cryptonote::tx_destination_entry> &dests, const crypto::hash &payment_id, uint64_t change_amount, uint32_t subaddr_account, const std::set<uint32_t>& subaddr_indices);
|
||||||
void generate_genesis(cryptonote::block& b);
|
void generate_genesis(cryptonote::block& b) const;
|
||||||
void check_genesis(const crypto::hash& genesis_hash) const; //throws
|
void check_genesis(const crypto::hash& genesis_hash) const; //throws
|
||||||
bool generate_chacha_key_from_secret_keys(crypto::chacha_key &key) const;
|
bool generate_chacha_key_from_secret_keys(crypto::chacha_key &key) const;
|
||||||
crypto::hash get_payment_id(const pending_tx &ptx) const;
|
crypto::hash get_payment_id(const pending_tx &ptx) const;
|
||||||
void check_acc_out_precomp(const cryptonote::tx_out &o, const crypto::key_derivation &derivation, const std::vector<crypto::key_derivation> &additional_derivations, size_t i, tx_scan_info_t &tx_scan_info) const;
|
void check_acc_out_precomp(const cryptonote::tx_out &o, const crypto::key_derivation &derivation, const std::vector<crypto::key_derivation> &additional_derivations, size_t i, tx_scan_info_t &tx_scan_info) const;
|
||||||
void parse_block_round(const cryptonote::blobdata &blob, cryptonote::block &bl, crypto::hash &bl_id, bool &error) const;
|
void parse_block_round(const cryptonote::blobdata &blob, cryptonote::block &bl, crypto::hash &bl_id, bool &error) const;
|
||||||
uint64_t get_upper_transaction_size_limit();
|
uint64_t get_upper_transaction_size_limit() const;
|
||||||
std::vector<uint64_t> get_unspent_amounts_vector();
|
std::vector<uint64_t> get_unspent_amounts_vector() const;
|
||||||
uint64_t get_dynamic_per_kb_fee_estimate();
|
uint64_t get_dynamic_per_kb_fee_estimate() const;
|
||||||
float get_output_relatedness(const transfer_details &td0, const transfer_details &td1) const;
|
float get_output_relatedness(const transfer_details &td0, const transfer_details &td1) const;
|
||||||
std::vector<size_t> pick_preferred_rct_inputs(uint64_t needed_money, uint32_t subaddr_account, const std::set<uint32_t> &subaddr_indices) const;
|
std::vector<size_t> pick_preferred_rct_inputs(uint64_t needed_money, uint32_t subaddr_account, const std::set<uint32_t> &subaddr_indices) const;
|
||||||
void set_spent(size_t idx, uint64_t height);
|
void set_spent(size_t idx, uint64_t height);
|
||||||
|
@ -1055,7 +1053,7 @@ namespace tools
|
||||||
crypto::public_key get_tx_pub_key_from_received_outs(const tools::wallet2::transfer_details &td) const;
|
crypto::public_key get_tx_pub_key_from_received_outs(const tools::wallet2::transfer_details &td) const;
|
||||||
bool should_pick_a_second_output(bool use_rct, size_t n_transfers, const std::vector<size_t> &unused_transfers_indices, const std::vector<size_t> &unused_dust_indices) const;
|
bool should_pick_a_second_output(bool use_rct, size_t n_transfers, const std::vector<size_t> &unused_transfers_indices, const std::vector<size_t> &unused_dust_indices) const;
|
||||||
std::vector<size_t> get_only_rct(const std::vector<size_t> &unused_dust_indices, const std::vector<size_t> &unused_transfers_indices) const;
|
std::vector<size_t> get_only_rct(const std::vector<size_t> &unused_dust_indices, const std::vector<size_t> &unused_transfers_indices) const;
|
||||||
void scan_output(const cryptonote::account_keys &keys, const cryptonote::transaction &tx, const crypto::public_key &tx_pub_key, size_t i, tx_scan_info_t &tx_scan_info, int &num_vouts_received, std::unordered_map<cryptonote::subaddress_index, uint64_t> &tx_money_got_in_outs, std::vector<size_t> &outs);
|
void scan_output(const cryptonote::transaction &tx, const crypto::public_key &tx_pub_key, size_t i, tx_scan_info_t &tx_scan_info, int &num_vouts_received, std::unordered_map<cryptonote::subaddress_index, uint64_t> &tx_money_got_in_outs, std::vector<size_t> &outs) const;
|
||||||
void trim_hashchain();
|
void trim_hashchain();
|
||||||
crypto::key_image get_multisig_composite_key_image(size_t n) const;
|
crypto::key_image get_multisig_composite_key_image(size_t n) const;
|
||||||
rct::multisig_kLRki get_multisig_composite_kLRki(size_t n, const crypto::public_key &ignore, std::unordered_set<rct::key> &used_L, std::unordered_set<rct::key> &new_used_L) const;
|
rct::multisig_kLRki get_multisig_composite_kLRki(size_t n, const crypto::public_key &ignore, std::unordered_set<rct::key> &used_L, std::unordered_set<rct::key> &new_used_L) const;
|
||||||
|
|
Loading…
Reference in a new issue