mirror of
https://github.com/monero-project/monero.git
synced 2025-08-05 23:24:20 -04:00
wallet: guard against partly initialized multisig wallet
This commit is contained in:
parent
66e34e85b1
commit
265290388b
6 changed files with 82 additions and 19 deletions
|
@ -2342,7 +2342,7 @@ namespace tools
|
|||
bool wallet_rpc_server::on_is_multisig(const wallet_rpc::COMMAND_RPC_IS_MULTISIG::request& req, wallet_rpc::COMMAND_RPC_IS_MULTISIG::response& res, epee::json_rpc::error& er)
|
||||
{
|
||||
if (!m_wallet) return not_open(er);
|
||||
res.multisig = m_wallet->multisig(&res.threshold, &res.total);
|
||||
res.multisig = m_wallet->multisig(&res.ready, &res.threshold, &res.total);
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -2468,12 +2468,19 @@ namespace tools
|
|||
er.message = "Command unavailable in restricted mode.";
|
||||
return false;
|
||||
}
|
||||
if (!m_wallet->multisig())
|
||||
bool ready;
|
||||
if (!m_wallet->multisig(&ready))
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_NOT_MULTISIG;
|
||||
er.message = "This wallet is not multisig";
|
||||
return false;
|
||||
}
|
||||
if (!ready)
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_NOT_MULTISIG;
|
||||
er.message = "This wallet is multisig, but not yet finalized";
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<tools::wallet2::multisig_info> info;
|
||||
try
|
||||
|
@ -2514,13 +2521,20 @@ namespace tools
|
|||
er.message = "Command unavailable in restricted mode.";
|
||||
return false;
|
||||
}
|
||||
bool ready;
|
||||
uint32_t threshold, total;
|
||||
if (!m_wallet->multisig(&threshold, &total))
|
||||
if (!m_wallet->multisig(&ready, &threshold, &total))
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_NOT_MULTISIG;
|
||||
er.message = "This wallet is not multisig";
|
||||
return false;
|
||||
}
|
||||
if (!ready)
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_NOT_MULTISIG;
|
||||
er.message = "This wallet is multisig, but not yet finalized";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (req.info.size() < threshold - 1)
|
||||
{
|
||||
|
@ -2607,13 +2621,20 @@ namespace tools
|
|||
er.message = "Command unavailable in restricted mode.";
|
||||
return false;
|
||||
}
|
||||
bool ready;
|
||||
uint32_t threshold, total;
|
||||
if (!m_wallet->multisig(&threshold, &total))
|
||||
if (!m_wallet->multisig(&ready, &threshold, &total))
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_NOT_MULTISIG;
|
||||
er.message = "This wallet is not multisig";
|
||||
return false;
|
||||
}
|
||||
if (ready)
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_ALREADY_MULTISIG;
|
||||
er.message = "This wallet is multisig, and already finalized";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (req.multisig_info.size() < threshold - 1)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue