From 6f53b0f14e30edc386f2180275035f5b023a62b9 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Fri, 21 Dec 2018 23:39:05 +0000 Subject: [PATCH] wallet2: finalize_multisig now rejects non N-1/N multisig wallets --- src/wallet/wallet2.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 22fd2ccfe..bb0ebe861 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -4480,6 +4480,23 @@ std::string wallet2::make_multisig(const epee::wipeable_string &password, bool wallet2::finalize_multisig(const epee::wipeable_string &password, const std::unordered_set &pkeys, std::vector signers) { + bool ready; + uint32_t threshold, total; + if (!multisig(&ready, &threshold, &total)) + { + MERROR("This is not a multisig wallet"); + return false; + } + if (ready) + { + MERROR("This multisig wallet is already finalized"); + return false; + } + if (threshold + 1 != total) + { + MERROR("finalize_multisig should only be used for N-1/N wallets, use exchange_multisig_keys instead"); + return false; + } exchange_multisig_keys(password, pkeys, signers); return true; }