Merge pull request #3615

24acb66e wallet2: fix misc issues when the ringdb can't be initialized (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2018-04-12 13:47:54 +02:00
commit 14c870ee5f
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
1 changed files with 9 additions and 9 deletions

View File

@ -5533,7 +5533,7 @@ bool wallet2::set_ring_database(const std::string &filename)
bool wallet2::add_rings(const crypto::chacha_key &key, const cryptonote::transaction_prefix &tx) bool wallet2::add_rings(const crypto::chacha_key &key, const cryptonote::transaction_prefix &tx)
{ {
if (!m_ringdb) if (!m_ringdb)
return true; return false;
try { return m_ringdb->add_rings(key, tx); } try { return m_ringdb->add_rings(key, tx); }
catch (const std::exception &e) { return false; } catch (const std::exception &e) { return false; }
} }
@ -5549,7 +5549,7 @@ bool wallet2::add_rings(const cryptonote::transaction_prefix &tx)
bool wallet2::remove_rings(const cryptonote::transaction_prefix &tx) bool wallet2::remove_rings(const cryptonote::transaction_prefix &tx)
{ {
if (!m_ringdb) if (!m_ringdb)
return true; return false;
crypto::chacha_key key; crypto::chacha_key key;
generate_chacha_key_from_secret_keys(key); generate_chacha_key_from_secret_keys(key);
try { return m_ringdb->remove_rings(key, tx); } try { return m_ringdb->remove_rings(key, tx); }
@ -5559,7 +5559,7 @@ bool wallet2::remove_rings(const cryptonote::transaction_prefix &tx)
bool wallet2::get_ring(const crypto::chacha_key &key, const crypto::key_image &key_image, std::vector<uint64_t> &outs) bool wallet2::get_ring(const crypto::chacha_key &key, const crypto::key_image &key_image, std::vector<uint64_t> &outs)
{ {
if (!m_ringdb) if (!m_ringdb)
return true; return false;
try { return m_ringdb->get_ring(key, key_image, outs); } try { return m_ringdb->get_ring(key, key_image, outs); }
catch (const std::exception &e) { return false; } catch (const std::exception &e) { return false; }
} }
@ -5599,7 +5599,7 @@ bool wallet2::get_ring(const crypto::key_image &key_image, std::vector<uint64_t>
bool wallet2::set_ring(const crypto::key_image &key_image, const std::vector<uint64_t> &outs, bool relative) bool wallet2::set_ring(const crypto::key_image &key_image, const std::vector<uint64_t> &outs, bool relative)
{ {
if (!m_ringdb) if (!m_ringdb)
return true; return false;
crypto::chacha_key key; crypto::chacha_key key;
generate_chacha_key_from_secret_keys(key); generate_chacha_key_from_secret_keys(key);
@ -5613,7 +5613,7 @@ bool wallet2::find_and_save_rings(bool force)
if (!force && m_ring_history_saved) if (!force && m_ring_history_saved)
return true; return true;
if (!m_ringdb) if (!m_ringdb)
return true; return false;
COMMAND_RPC_GET_TRANSACTIONS::request req = AUTO_VAL_INIT(req); COMMAND_RPC_GET_TRANSACTIONS::request req = AUTO_VAL_INIT(req);
COMMAND_RPC_GET_TRANSACTIONS::response res = AUTO_VAL_INIT(res); COMMAND_RPC_GET_TRANSACTIONS::response res = AUTO_VAL_INIT(res);
@ -5672,7 +5672,7 @@ bool wallet2::find_and_save_rings(bool force)
bool wallet2::blackball_output(const crypto::public_key &output) bool wallet2::blackball_output(const crypto::public_key &output)
{ {
if (!m_ringdb) if (!m_ringdb)
return true; return false;
try { return m_ringdb->blackball(output); } try { return m_ringdb->blackball(output); }
catch (const std::exception &e) { return false; } catch (const std::exception &e) { return false; }
} }
@ -5680,7 +5680,7 @@ bool wallet2::blackball_output(const crypto::public_key &output)
bool wallet2::set_blackballed_outputs(const std::vector<crypto::public_key> &outputs, bool add) bool wallet2::set_blackballed_outputs(const std::vector<crypto::public_key> &outputs, bool add)
{ {
if (!m_ringdb) if (!m_ringdb)
return true; return false;
try try
{ {
bool ret = true; bool ret = true;
@ -5696,7 +5696,7 @@ bool wallet2::set_blackballed_outputs(const std::vector<crypto::public_key> &out
bool wallet2::unblackball_output(const crypto::public_key &output) bool wallet2::unblackball_output(const crypto::public_key &output)
{ {
if (!m_ringdb) if (!m_ringdb)
return true; return false;
try { return m_ringdb->unblackball(output); } try { return m_ringdb->unblackball(output); }
catch (const std::exception &e) { return false; } catch (const std::exception &e) { return false; }
} }
@ -5704,7 +5704,7 @@ bool wallet2::unblackball_output(const crypto::public_key &output)
bool wallet2::is_output_blackballed(const crypto::public_key &output) const bool wallet2::is_output_blackballed(const crypto::public_key &output) const
{ {
if (!m_ringdb) if (!m_ringdb)
return true; return false;
try { return m_ringdb->blackballed(output); } try { return m_ringdb->blackballed(output); }
catch (const std::exception &e) { return false; } catch (const std::exception &e) { return false; }
} }