aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-06-02 13:06:41 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-06-27 21:38:21 +0100
commitdcbc17e97e782d168d1653e216d415bb4d34a892 (patch)
treea4702dae618ce6965765af1008aad4673af867e4 /src/wallet/wallet2.cpp
parentMerge pull request #3716 (diff)
downloadmonero-dcbc17e97e782d168d1653e216d415bb4d34a892.tar.xz
wallet: include a suggested number of confirmations based on amount
This is based on how much an attacking miner stands to lose in block rewardy by mining a private chain which double spends a payment. This is not foolproof, since mining is based on luck, and breaks down as the attacking miner nears 50% of the network hash rate, and the estimation is based on a constant block reward.
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r--src/wallet/wallet2.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index aa6874d17..5b8f1738b 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -686,7 +686,8 @@ wallet2::wallet2(network_type nettype, bool restricted):
m_light_wallet_unlocked_balance(0),
m_key_on_device(false),
m_ring_history_saved(false),
- m_ringdb()
+ m_ringdb(),
+ m_last_block_reward(0)
{
}
@@ -1672,6 +1673,7 @@ void wallet2::process_new_blockchain_entry(const cryptonote::block& b, const cry
process_new_transaction(b.tx_hashes[idx], parsed_block.txes[idx], parsed_block.o_indices.indices[idx+1].indices, height, b.timestamp, false, false, false, tx_cache_data[tx_cache_data_offset++]);
}
TIME_MEASURE_FINISH(txs_handle_time);
+ m_last_block_reward = cryptonote::get_outs_money_amount(b.miner_tx);
LOG_PRINT_L2("Processed block: " << bl_id << ", height " << height << ", " << miner_tx_handle_time + txs_handle_time << "(" << miner_tx_handle_time << "/" << txs_handle_time <<")ms");
}else
{
@@ -3166,6 +3168,7 @@ void wallet2::generate(const std::string& wallet_, const epee::wipeable_string&
cryptonote::block b;
generate_genesis(b);
m_blockchain.push_back(get_block_hash(b));
+ m_last_block_reward = cryptonote::get_outs_money_amount(b.miner_tx);
add_subaddress_account(tr("Primary account"));
if (!wallet_.empty())
@@ -3224,6 +3227,7 @@ crypto::secret_key wallet2::generate(const std::string& wallet_, const epee::wip
cryptonote::block b;
generate_genesis(b);
m_blockchain.push_back(get_block_hash(b));
+ m_last_block_reward = cryptonote::get_outs_money_amount(b.miner_tx);
add_subaddress_account(tr("Primary account"));
if (!wallet_.empty())
@@ -3319,6 +3323,7 @@ void wallet2::generate(const std::string& wallet_, const epee::wipeable_string&
cryptonote::block b;
generate_genesis(b);
m_blockchain.push_back(get_block_hash(b));
+ m_last_block_reward = cryptonote::get_outs_money_amount(b.miner_tx);
add_subaddress_account(tr("Primary account"));
if (!wallet_.empty())
@@ -3371,6 +3376,7 @@ void wallet2::generate(const std::string& wallet_, const epee::wipeable_string&
cryptonote::block b;
generate_genesis(b);
m_blockchain.push_back(get_block_hash(b));
+ m_last_block_reward = cryptonote::get_outs_money_amount(b.miner_tx);
add_subaddress_account(tr("Primary account"));
if (!wallet_.empty())
@@ -3417,6 +3423,7 @@ void wallet2::restore(const std::string& wallet_, const epee::wipeable_string& p
m_subaddress_lookahead_major = 5;
m_subaddress_lookahead_minor = 20;
}
+ m_last_block_reward = cryptonote::get_outs_money_amount(b.miner_tx);
add_subaddress_account(tr("Primary account"));
if (!wallet_.empty()) {
store();
@@ -3513,6 +3520,7 @@ std::string wallet2::make_multisig(const epee::wipeable_string &password,
cryptonote::block b;
generate_genesis(b);
m_blockchain.push_back(get_block_hash(b));
+ m_last_block_reward = cryptonote::get_outs_money_amount(b.miner_tx);
add_subaddress_account(tr("Primary account"));
if (!m_wallet_file.empty())
@@ -4015,6 +4023,7 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass
if (m_blockchain.empty())
{
m_blockchain.push_back(genesis_hash);
+ m_last_block_reward = cryptonote::get_outs_money_amount(genesis.miner_tx);
}
else
{
@@ -4404,6 +4413,7 @@ void wallet2::rescan_blockchain(bool refresh)
generate_genesis(genesis);
crypto::hash genesis_hash = get_block_hash(genesis);
m_blockchain.push_back(genesis_hash);
+ m_last_block_reward = cryptonote::get_outs_money_amount(genesis.miner_tx);
add_subaddress_account(tr("Primary account"));
if (refresh)
@@ -10006,6 +10016,7 @@ void wallet2::import_blockchain(const std::tuple<size_t, crypto::hash, std::vect
generate_genesis(genesis);
crypto::hash genesis_hash = get_block_hash(genesis);
check_genesis(genesis_hash);
+ m_last_block_reward = cryptonote::get_outs_money_amount(genesis.miner_tx);
}
//----------------------------------------------------------------------------------------------------
std::vector<tools::wallet2::transfer_details> wallet2::export_outputs() const