Merge pull request #3534

eecfb57d wallet: warn if not using the default ring size (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2018-04-12 13:47:19 +02:00
commit 5d8439e310
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
3 changed files with 30 additions and 0 deletions

View File

@ -1650,6 +1650,9 @@ bool simple_wallet::set_default_ring_size(const std::vector<std::string> &args/*
return true; return true;
} }
if (ring_size != 0 && ring_size != DEFAULT_MIX+1)
message_writer() << tr("WARNING: this is a non default ring size, which may harm your privacy. Default is recommended.");
const auto pwd_container = get_and_verify_password(); const auto pwd_container = get_and_verify_password();
if (pwd_container) if (pwd_container)
{ {
@ -4600,6 +4603,23 @@ bool simple_wallet::transfer_main(int transfer_type, const std::vector<std::stri
if (!print_ring_members(ptx_vector, prompt)) if (!print_ring_members(ptx_vector, prompt))
return true; return true;
} }
bool default_ring_size = true;
for (const auto &ptx: ptx_vector)
{
for (const auto &vin: ptx.tx.vin)
{
if (vin.type() == typeid(txin_to_key))
{
const txin_to_key& in_to_key = boost::get<txin_to_key>(vin);
if (in_to_key.key_offsets.size() != DEFAULT_MIX + 1)
default_ring_size = false;
}
}
}
if (m_wallet->confirm_non_default_ring_size() && !default_ring_size)
{
prompt << tr("WARNING: this is a non default ring size, which may harm your privacy. Default is recommended.");
}
prompt << ENDL << tr("Is this okay? (Y/Yes/N/No): "); prompt << ENDL << tr("Is this okay? (Y/Yes/N/No): ");
std::string accepted = input_line(prompt.str()); std::string accepted = input_line(prompt.str());

View File

@ -653,6 +653,7 @@ wallet2::wallet2(network_type nettype, bool restricted):
m_refresh_from_block_height(0), m_refresh_from_block_height(0),
m_explicit_refresh_from_block_height(true), m_explicit_refresh_from_block_height(true),
m_confirm_missing_payment_id(true), m_confirm_missing_payment_id(true),
m_confirm_non_default_ring_size(true),
m_ask_password(true), m_ask_password(true),
m_min_output_count(0), m_min_output_count(0),
m_min_output_value(0), m_min_output_value(0),
@ -2584,6 +2585,9 @@ bool wallet2::store_keys(const std::string& keys_file_name, const epee::wipeable
value2.SetInt(m_confirm_missing_payment_id ? 1 :0); value2.SetInt(m_confirm_missing_payment_id ? 1 :0);
json.AddMember("confirm_missing_payment_id", value2, json.GetAllocator()); json.AddMember("confirm_missing_payment_id", value2, json.GetAllocator());
value2.SetInt(m_confirm_non_default_ring_size ? 1 :0);
json.AddMember("confirm_non_default_ring_size", value2, json.GetAllocator());
value2.SetInt(m_ask_password ? 1 :0); value2.SetInt(m_ask_password ? 1 :0);
json.AddMember("ask_password", value2, json.GetAllocator()); json.AddMember("ask_password", value2, json.GetAllocator());
@ -2685,6 +2689,7 @@ bool wallet2::load_keys(const std::string& keys_file_name, const epee::wipeable_
m_auto_refresh = true; m_auto_refresh = true;
m_refresh_type = RefreshType::RefreshDefault; m_refresh_type = RefreshType::RefreshDefault;
m_confirm_missing_payment_id = true; m_confirm_missing_payment_id = true;
m_confirm_non_default_ring_size = true;
m_ask_password = true; m_ask_password = true;
m_min_output_count = 0; m_min_output_count = 0;
m_min_output_value = 0; m_min_output_value = 0;
@ -2788,6 +2793,8 @@ bool wallet2::load_keys(const std::string& keys_file_name, const epee::wipeable_
m_refresh_from_block_height = field_refresh_height; m_refresh_from_block_height = field_refresh_height;
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, confirm_missing_payment_id, int, Int, false, true); GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, confirm_missing_payment_id, int, Int, false, true);
m_confirm_missing_payment_id = field_confirm_missing_payment_id; m_confirm_missing_payment_id = field_confirm_missing_payment_id;
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, confirm_non_default_ring_size, int, Int, false, true);
m_confirm_non_default_ring_size = field_confirm_non_default_ring_size;
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, ask_password, int, Int, false, true); GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, ask_password, int, Int, false, true);
m_ask_password = field_ask_password; m_ask_password = field_ask_password;
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, default_decimal_point, int, Int, false, CRYPTONOTE_DISPLAY_DECIMAL_POINT); GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, default_decimal_point, int, Int, false, CRYPTONOTE_DISPLAY_DECIMAL_POINT);

View File

@ -874,6 +874,8 @@ namespace tools
void key_reuse_mitigation2(bool value) { m_key_reuse_mitigation2 = value; } void key_reuse_mitigation2(bool value) { m_key_reuse_mitigation2 = value; }
uint64_t segregation_height() const { return m_segregation_height; } uint64_t segregation_height() const { return m_segregation_height; }
void segregation_height(uint64_t height) { m_segregation_height = height; } void segregation_height(uint64_t height) { m_segregation_height = height; }
bool confirm_non_default_ring_size() const { return m_confirm_non_default_ring_size; }
void confirm_non_default_ring_size(bool always) { m_confirm_non_default_ring_size = always; }
bool get_tx_key(const crypto::hash &txid, crypto::secret_key &tx_key, std::vector<crypto::secret_key> &additional_tx_keys) const; bool get_tx_key(const crypto::hash &txid, crypto::secret_key &tx_key, std::vector<crypto::secret_key> &additional_tx_keys) const;
void check_tx_key(const crypto::hash &txid, const crypto::secret_key &tx_key, const std::vector<crypto::secret_key> &additional_tx_keys, const cryptonote::account_public_address &address, uint64_t &received, bool &in_pool, uint64_t &confirmations); void check_tx_key(const crypto::hash &txid, const crypto::secret_key &tx_key, const std::vector<crypto::secret_key> &additional_tx_keys, const cryptonote::account_public_address &address, uint64_t &received, bool &in_pool, uint64_t &confirmations);
@ -1194,6 +1196,7 @@ namespace tools
// m_refresh_from_block_height was defaulted to zero.*/ // m_refresh_from_block_height was defaulted to zero.*/
bool m_explicit_refresh_from_block_height; bool m_explicit_refresh_from_block_height;
bool m_confirm_missing_payment_id; bool m_confirm_missing_payment_id;
bool m_confirm_non_default_ring_size;
bool m_ask_password; bool m_ask_password;
uint32_t m_min_output_count; uint32_t m_min_output_count;
uint64_t m_min_output_value; uint64_t m_min_output_value;