aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2022-09-15 16:25:22 -0500
committerluigi1111 <luigi1111w@gmail.com>2022-09-15 16:25:22 -0500
commit7cbae6ca988dedbe358ee5edbf9bdd610673a8ee (patch)
tree7087c8405264f60dc0bc0e4aa238df82f6554fac /src/wallet/wallet2.cpp
parentMerge pull request #8544 (diff)
parentMerge pull request #5 from j-berman/restore-msig-encrypted-seed (diff)
downloadmonero-7cbae6ca988dedbe358ee5edbf9bdd610673a8ee.tar.xz
Merge pull request #8545v0.18.1.1
12e7c41 Merge pull request #5 from j-berman/restore-msig-encrypted-seed (Justin Berman) 848a0c0 Fix segfault restoring encrypted multisig seed (j-berman) 401f5d9 Require user ack multisig is experimental to restore (j-berman) fc8a5d6 multisig: fix #8537 seed restore (suggestions by @UkoeHB) (j-berman)
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r--src/wallet/wallet2.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index eb5dc73a9..588ddd572 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -4737,7 +4737,8 @@ void wallet2::init_type(hw::device::device_type device_type)
}
/*!
- * \brief Generates a wallet or restores one.
+ * \brief Generates a wallet or restores one. Assumes the multisig setup
+ * has already completed for the provided multisig info.
* \param wallet_ Name of wallet file
* \param password Password of wallet file
* \param multisig_data The multisig restore info and keys
@@ -4796,11 +4797,6 @@ void wallet2::generate(const std::string& wallet_, const epee::wipeable_string&
crypto::public_key local_signer;
THROW_WALLET_EXCEPTION_IF(!crypto::secret_key_to_public_key(spend_secret_key, local_signer), error::invalid_multisig_seed);
THROW_WALLET_EXCEPTION_IF(std::find(multisig_signers.begin(), multisig_signers.end(), local_signer) == multisig_signers.end(), error::invalid_multisig_seed);
- rct::key skey = rct::zero();
- for (const auto &msk: multisig_keys)
- sc_add(skey.bytes, skey.bytes, rct::sk2rct(msk).bytes);
- THROW_WALLET_EXCEPTION_IF(!(rct::rct2sk(skey) == spend_secret_key), error::invalid_multisig_seed);
- memwipe(&skey, sizeof(rct::key));
m_account.make_multisig(view_secret_key, spend_secret_key, spend_public_key, multisig_keys);
@@ -4811,6 +4807,8 @@ void wallet2::generate(const std::string& wallet_, const epee::wipeable_string&
m_multisig = true;
m_multisig_threshold = threshold;
m_multisig_signers = multisig_signers;
+ // wallet is assumed already finalized
+ m_multisig_rounds_passed = multisig::multisig_setup_rounds_required(m_multisig_signers.size(), m_multisig_threshold);
setup_keys(password);
create_keys_file(wallet_, false, password, m_nettype != MAINNET || create_address_file);
@@ -5261,7 +5259,7 @@ bool wallet2::multisig(bool *ready, uint32_t *threshold, uint32_t *total) const
if (ready)
{
*ready = !(get_account().get_keys().m_account_address.m_spend_public_key == rct::rct2pk(rct::identity())) &&
- (m_multisig_rounds_passed == multisig::multisig_kex_rounds_required(m_multisig_signers.size(), m_multisig_threshold) + 1);
+ (m_multisig_rounds_passed == multisig::multisig_setup_rounds_required(m_multisig_signers.size(), m_multisig_threshold));
}
return true;
}