diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-11-18 11:24:38 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-12-17 16:12:44 +0000 |
commit | 98db7ee467fb4f73ce5e748d4891326b84a4c93a (patch) | |
tree | 00f60b318f05fdc092ebf658c2bb9e64be95e8d1 /src/wallet/wallet_rpc_server.cpp | |
parent | wallet: use raw encrypted data in multisig import/export RPC (diff) | |
download | monero-98db7ee467fb4f73ce5e748d4891326b84a4c93a.tar.xz |
wallet: factor multisig info parsing
Diffstat (limited to 'src/wallet/wallet_rpc_server.cpp')
-rw-r--r-- | src/wallet/wallet_rpc_server.cpp | 51 |
1 files changed, 1 insertions, 50 deletions
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index 4c14433f4..0482b9dd6 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -2539,58 +2539,9 @@ namespace tools return false; } - // parse all multisig info - std::vector<crypto::secret_key> secret_keys(req.multisig_info.size()); - std::vector<crypto::public_key> public_keys(req.multisig_info.size()); - for (size_t i = 0; i < req.multisig_info.size(); ++i) - { - if (!m_wallet->verify_multisig_info(req.multisig_info[i], secret_keys[i], public_keys[i])) - { - er.code = WALLET_RPC_ERROR_CODE_BAD_MULTISIG_INFO; - er.message = "Bad multisig info: " + req.multisig_info[i]; - return false; - } - } - - // remove duplicates - for (size_t i = 1; i < secret_keys.size(); ++i) - { - for (size_t j = i + 1; j < secret_keys.size(); ++j) - { - if (rct::sk2rct(secret_keys[i]) == rct::sk2rct(secret_keys[j])) - { - secret_keys[j] = secret_keys.back(); - public_keys[j] = public_keys.back(); - secret_keys.pop_back(); - public_keys.pop_back(); - --j; - } - } - } - - // people may include their own, weed it out - crypto::secret_key local_skey = cryptonote::get_multisig_blinded_secret_key(m_wallet->get_account().get_keys().m_view_secret_key); - for (size_t i = 0; i < secret_keys.size(); ++i) - { - if (rct::sk2rct(secret_keys[i]) == rct::sk2rct(local_skey)) - { - secret_keys[i] = secret_keys.back(); - public_keys[i] = public_keys.back(); - secret_keys.pop_back(); - public_keys.pop_back(); - --i; - } - else if (public_keys[i] == m_wallet->get_account().get_keys().m_account_address.m_spend_public_key) - { - er.code = WALLET_RPC_ERROR_CODE_BAD_MULTISIG_INFO; - er.message = "Found local spend public key, but not local view secret key - something very weird"; - return false; - } - } - try { - res.multisig_info = m_wallet->make_multisig(req.password, secret_keys, public_keys, req.threshold); + res.multisig_info = m_wallet->make_multisig(req.password, req.multisig_info, req.threshold); res.address = m_wallet->get_account().get_public_address_str(m_wallet->testnet()); } catch (const std::exception &e) |