mirror of
https://github.com/monero-project/monero.git
synced 2024-10-01 11:49:47 -04:00
wallet: add consts where appropriate
because const is always appropriate
This commit is contained in:
parent
5001489353
commit
09324764c0
@ -89,7 +89,7 @@ void wallet2::init(const std::string& daemon_address, uint64_t upper_transaction
|
|||||||
m_daemon_address = daemon_address;
|
m_daemon_address = daemon_address;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
bool wallet2::is_deterministic()
|
bool wallet2::is_deterministic() const
|
||||||
{
|
{
|
||||||
crypto::secret_key second;
|
crypto::secret_key second;
|
||||||
keccak((uint8_t *)&get_account().get_keys().m_spend_secret_key, sizeof(crypto::secret_key), (uint8_t *)&second, sizeof(crypto::secret_key));
|
keccak((uint8_t *)&get_account().get_keys().m_spend_secret_key, sizeof(crypto::secret_key), (uint8_t *)&second, sizeof(crypto::secret_key));
|
||||||
@ -98,7 +98,7 @@ bool wallet2::is_deterministic()
|
|||||||
return keys_deterministic;
|
return keys_deterministic;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
bool wallet2::get_seed(std::string& electrum_words)
|
bool wallet2::get_seed(std::string& electrum_words) const
|
||||||
{
|
{
|
||||||
bool keys_deterministic = is_deterministic();
|
bool keys_deterministic = is_deterministic();
|
||||||
if (!keys_deterministic)
|
if (!keys_deterministic)
|
||||||
@ -119,7 +119,7 @@ bool wallet2::get_seed(std::string& electrum_words)
|
|||||||
/*!
|
/*!
|
||||||
* \brief Gets the seed language
|
* \brief Gets the seed language
|
||||||
*/
|
*/
|
||||||
const std::string wallet2::get_seed_language()
|
const std::string &wallet2::get_seed_language() const
|
||||||
{
|
{
|
||||||
return seed_language;
|
return seed_language;
|
||||||
}
|
}
|
||||||
@ -287,7 +287,7 @@ void wallet2::process_new_blockchain_entry(const cryptonote::block& b, cryptonot
|
|||||||
m_callback->on_new_block(height, b);
|
m_callback->on_new_block(height, b);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
void wallet2::get_short_chain_history(std::list<crypto::hash>& ids)
|
void wallet2::get_short_chain_history(std::list<crypto::hash>& ids) const
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
size_t current_multiplier = 1;
|
size_t current_multiplier = 1;
|
||||||
@ -580,7 +580,7 @@ void wallet2::load_keys(const std::string& keys_file_name, const std::string& pa
|
|||||||
* can be used prior to rewriting wallet keys file, to ensure user has entered the correct password
|
* can be used prior to rewriting wallet keys file, to ensure user has entered the correct password
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
bool wallet2::verify_password(const std::string& password)
|
bool wallet2::verify_password(const std::string& password) const
|
||||||
{
|
{
|
||||||
const std::string keys_file_name = m_keys_file;
|
const std::string keys_file_name = m_keys_file;
|
||||||
wallet2::keys_file_data keys_file_data;
|
wallet2::keys_file_data keys_file_data;
|
||||||
@ -765,7 +765,7 @@ void wallet2::load(const std::string& wallet_, const std::string& password)
|
|||||||
m_local_bc_height = m_blockchain.size();
|
m_local_bc_height = m_blockchain.size();
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
void wallet2::check_genesis(const crypto::hash& genesis_hash) {
|
void wallet2::check_genesis(const crypto::hash& genesis_hash) const {
|
||||||
std::string what("Genesis block missmatch. You probably use wallet without testnet flag with blockchain from test network or vice versa");
|
std::string what("Genesis block missmatch. You probably use wallet without testnet flag with blockchain from test network or vice versa");
|
||||||
|
|
||||||
THROW_WALLET_EXCEPTION_IF(genesis_hash != m_blockchain[0], error::wallet_internal_error, what);
|
THROW_WALLET_EXCEPTION_IF(genesis_hash != m_blockchain[0], error::wallet_internal_error, what);
|
||||||
@ -777,17 +777,17 @@ void wallet2::store()
|
|||||||
THROW_WALLET_EXCEPTION_IF(!r, error::file_save_error, m_wallet_file);
|
THROW_WALLET_EXCEPTION_IF(!r, error::file_save_error, m_wallet_file);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
uint64_t wallet2::unlocked_balance()
|
uint64_t wallet2::unlocked_balance() const
|
||||||
{
|
{
|
||||||
uint64_t amount = 0;
|
uint64_t amount = 0;
|
||||||
BOOST_FOREACH(transfer_details& td, m_transfers)
|
BOOST_FOREACH(const transfer_details& td, m_transfers)
|
||||||
if(!td.m_spent && is_transfer_unlocked(td))
|
if(!td.m_spent && is_transfer_unlocked(td))
|
||||||
amount += td.amount();
|
amount += td.amount();
|
||||||
|
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
uint64_t wallet2::balance()
|
uint64_t wallet2::balance() const
|
||||||
{
|
{
|
||||||
uint64_t amount = 0;
|
uint64_t amount = 0;
|
||||||
BOOST_FOREACH(auto& td, m_transfers)
|
BOOST_FOREACH(auto& td, m_transfers)
|
||||||
|
@ -157,8 +157,9 @@ namespace tools
|
|||||||
/*!
|
/*!
|
||||||
* \brief verifies given password is correct for default wallet keys file
|
* \brief verifies given password is correct for default wallet keys file
|
||||||
*/
|
*/
|
||||||
bool verify_password(const std::string& password);
|
bool verify_password(const std::string& password) const;
|
||||||
cryptonote::account_base& get_account(){return m_account;}
|
cryptonote::account_base& get_account(){return m_account;}
|
||||||
|
const cryptonote::account_base& get_account()const{return m_account;}
|
||||||
|
|
||||||
// upper_transaction_size_limit as defined below is set to
|
// upper_transaction_size_limit as defined below is set to
|
||||||
// approximately 125% of the fixed minimum allowable penalty
|
// approximately 125% of the fixed minimum allowable penalty
|
||||||
@ -176,12 +177,12 @@ namespace tools
|
|||||||
/*!
|
/*!
|
||||||
* \brief Checks if deterministic wallet
|
* \brief Checks if deterministic wallet
|
||||||
*/
|
*/
|
||||||
bool is_deterministic();
|
bool is_deterministic() const;
|
||||||
bool get_seed(std::string& electrum_words);
|
bool get_seed(std::string& electrum_words) const;
|
||||||
/*!
|
/*!
|
||||||
* \brief Gets the seed language
|
* \brief Gets the seed language
|
||||||
*/
|
*/
|
||||||
const std::string get_seed_language();
|
const std::string &get_seed_language() const;
|
||||||
/*!
|
/*!
|
||||||
* \brief Sets the seed language
|
* \brief Sets the seed language
|
||||||
*/
|
*/
|
||||||
@ -195,11 +196,11 @@ namespace tools
|
|||||||
void refresh(uint64_t start_height, size_t & blocks_fetched, bool& received_money);
|
void refresh(uint64_t start_height, size_t & blocks_fetched, bool& received_money);
|
||||||
bool refresh(size_t & blocks_fetched, bool& received_money, bool& ok);
|
bool refresh(size_t & blocks_fetched, bool& received_money, bool& ok);
|
||||||
|
|
||||||
bool testnet() { return m_testnet; }
|
bool testnet() const { return m_testnet; }
|
||||||
bool restricted() const { return m_restricted; }
|
bool restricted() const { return m_restricted; }
|
||||||
|
|
||||||
uint64_t balance();
|
uint64_t balance() const;
|
||||||
uint64_t unlocked_balance();
|
uint64_t unlocked_balance() const;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void transfer(const std::vector<cryptonote::tx_destination_entry>& dsts, size_t fake_outputs_count, uint64_t unlock_time, uint64_t fee, const std::vector<uint8_t>& extra, T destination_split_strategy, const tx_dust_policy& dust_policy);
|
void transfer(const std::vector<cryptonote::tx_destination_entry>& dsts, size_t fake_outputs_count, uint64_t unlock_time, uint64_t fee, const std::vector<uint8_t>& extra, T destination_split_strategy, const tx_dust_policy& dust_policy);
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -267,7 +268,7 @@ namespace tools
|
|||||||
void process_new_transaction(const cryptonote::transaction& tx, uint64_t height);
|
void process_new_transaction(const cryptonote::transaction& tx, uint64_t height);
|
||||||
void process_new_blockchain_entry(const cryptonote::block& b, cryptonote::block_complete_entry& bche, crypto::hash& bl_id, uint64_t height);
|
void process_new_blockchain_entry(const cryptonote::block& b, cryptonote::block_complete_entry& bche, crypto::hash& bl_id, uint64_t height);
|
||||||
void detach_blockchain(uint64_t height);
|
void detach_blockchain(uint64_t height);
|
||||||
void get_short_chain_history(std::list<crypto::hash>& ids);
|
void get_short_chain_history(std::list<crypto::hash>& ids) const;
|
||||||
bool is_tx_spendtime_unlocked(uint64_t unlock_time) const;
|
bool is_tx_spendtime_unlocked(uint64_t unlock_time) const;
|
||||||
bool is_transfer_unlocked(const transfer_details& td) const;
|
bool is_transfer_unlocked(const transfer_details& td) const;
|
||||||
bool clear();
|
bool clear();
|
||||||
@ -277,7 +278,7 @@ namespace tools
|
|||||||
void process_unconfirmed(const cryptonote::transaction& tx);
|
void process_unconfirmed(const cryptonote::transaction& tx);
|
||||||
void add_unconfirmed_tx(const cryptonote::transaction& tx, uint64_t change_amount);
|
void add_unconfirmed_tx(const cryptonote::transaction& tx, uint64_t change_amount);
|
||||||
void generate_genesis(cryptonote::block& b);
|
void generate_genesis(cryptonote::block& b);
|
||||||
void check_genesis(const crypto::hash& genesis_hash); //throws
|
void check_genesis(const crypto::hash& genesis_hash) const; //throws
|
||||||
|
|
||||||
cryptonote::account_base m_account;
|
cryptonote::account_base m_account;
|
||||||
std::string m_daemon_address;
|
std::string m_daemon_address;
|
||||||
|
Loading…
Reference in New Issue
Block a user