aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-11-16 11:13:09 +0200
committerRiccardo Spagni <ric@spagni.net>2018-11-16 11:13:09 +0200
commit056abf980e2dd98243244645b4a2f3f34fe04f56 (patch)
tree778ef53455021c85af583cc04b9b4ae29cb2b934 /src
parentMerge pull request #4800 (diff)
parentwallet_rpc_server: account for watch-only/non-deterministic/multisig when que... (diff)
downloadmonero-056abf980e2dd98243244645b4a2f3f34fe04f56.tar.xz
Merge pull request #4801
7ae36e91 wallet_rpc_server: account for watch-only/non-deterministic/multisig when querying seed (stoffu)
Diffstat (limited to 'src')
-rw-r--r--src/wallet/wallet_rpc_server.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp
index 533784acf..0eb09b9f1 100644
--- a/src/wallet/wallet_rpc_server.cpp
+++ b/src/wallet/wallet_rpc_server.cpp
@@ -1746,11 +1746,42 @@ namespace tools
if (req.key_type.compare("mnemonic") == 0)
{
epee::wipeable_string seed;
- if (!m_wallet->get_seed(seed))
+ bool ready;
+ if (m_wallet->multisig(&ready))
{
+ if (!ready)
+ {
+ er.code = WALLET_RPC_ERROR_CODE_NOT_MULTISIG;
+ er.message = "This wallet is multisig, but not yet finalized";
+ return false;
+ }
+ if (!m_wallet->get_multisig_seed(seed))
+ {
+ er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;
+ er.message = "Failed to get multisig seed.";
+ return false;
+ }
+ }
+ else
+ {
+ if (m_wallet->watch_only())
+ {
+ er.code = WALLET_RPC_ERROR_CODE_WATCH_ONLY;
+ er.message = "The wallet is watch-only. Cannot display seed.";
+ return false;
+ }
+ if (!m_wallet->is_deterministic())
+ {
er.code = WALLET_RPC_ERROR_CODE_NON_DETERMINISTIC;
er.message = "The wallet is non-deterministic. Cannot display seed.";
return false;
+ }
+ if (!m_wallet->get_seed(seed))
+ {
+ er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;
+ er.message = "Failed to get seed.";
+ return false;
+ }
}
res.key = std::string(seed.data(), seed.size()); // send to the network, then wipe RAM :D
}