mirror of
https://github.com/monero-project/monero.git
synced 2024-11-18 00:37:43 +00:00
Merge pull request #4801
7ae36e91
wallet_rpc_server: account for watch-only/non-deterministic/multisig when querying seed (stoffu)
This commit is contained in:
commit
056abf980e
1 changed files with 32 additions and 1 deletions
|
@ -1746,12 +1746,43 @@ namespace tools
|
||||||
if (req.key_type.compare("mnemonic") == 0)
|
if (req.key_type.compare("mnemonic") == 0)
|
||||||
{
|
{
|
||||||
epee::wipeable_string seed;
|
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.code = WALLET_RPC_ERROR_CODE_NON_DETERMINISTIC;
|
||||||
er.message = "The wallet is non-deterministic. Cannot display seed.";
|
er.message = "The wallet is non-deterministic. Cannot display seed.";
|
||||||
return false;
|
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
|
res.key = std::string(seed.data(), seed.size()); // send to the network, then wipe RAM :D
|
||||||
}
|
}
|
||||||
else if(req.key_type.compare("view_key") == 0)
|
else if(req.key_type.compare("view_key") == 0)
|
||||||
|
|
Loading…
Reference in a new issue