From 755e18f5d80810b3cf64e1d63a182f472d16c5d0 Mon Sep 17 00:00:00 2001 From: woodser Date: Sat, 7 Dec 2019 10:43:29 -0500 Subject: [PATCH] get_mnemonic(), get_mnemonic_language() throws if watch-only --- src/wallet/monero_wallet_core.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/wallet/monero_wallet_core.cpp b/src/wallet/monero_wallet_core.cpp index c9bdaea..94bdc27 100644 --- a/src/wallet/monero_wallet_core.cpp +++ b/src/wallet/monero_wallet_core.cpp @@ -994,7 +994,15 @@ namespace monero { return static_cast(m_w2->nettype()); } + string monero_wallet_core::get_mnemonic() const { + if (m_w2->watch_only()) throw runtime_error("The wallet is watch-only. Cannot retrieve mnemonic."); + epee::wipeable_string wipeable_mnemonic; + m_w2->get_seed(wipeable_mnemonic); + return string(wipeable_mnemonic.data(), wipeable_mnemonic.size()); + } + string monero_wallet_core::get_mnemonic_language() const { + if (m_w2->watch_only()) throw runtime_error("The wallet is watch-only. Cannot retrieve mnemonic language."); return m_w2->get_seed_language(); } @@ -1004,12 +1012,6 @@ namespace monero { return languages; } - string monero_wallet_core::get_mnemonic() const { - epee::wipeable_string wipeable_mnemonic; - m_w2->get_seed(wipeable_mnemonic); - return string(wipeable_mnemonic.data(), wipeable_mnemonic.size()); - } - string monero_wallet_core::get_public_view_key() const { MTRACE("get_private_view_key()"); return epee::string_tools::pod_to_hex(m_w2->get_account().get_keys().m_account_address.m_view_public_key);