diff options
author | koe <ukoe@protonmail.com> | 2022-04-29 14:04:59 -0500 |
---|---|---|
committer | koe <ukoe@protonmail.com> | 2022-04-29 14:04:59 -0500 |
commit | 0d6ecb113651ac99abd25a04fe4ddb9ac0a73c3e (patch) | |
tree | 3b7d1c453e2d38060f1c26b020f22e74309e2ef3 /tests/unit_tests/multisig.cpp | |
parent | Merge pull request #8161 (diff) | |
download | monero-0d6ecb113651ac99abd25a04fe4ddb9ac0a73c3e.tar.xz |
multisig: add post-kex verification round to check that all participants have completed the multisig address
Diffstat (limited to 'tests/unit_tests/multisig.cpp')
-rw-r--r-- | tests/unit_tests/multisig.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/tests/unit_tests/multisig.cpp b/tests/unit_tests/multisig.cpp index 362a658de..c4e24fa53 100644 --- a/tests/unit_tests/multisig.cpp +++ b/tests/unit_tests/multisig.cpp @@ -120,7 +120,7 @@ static void check_results(const std::vector<std::string> &intermediate_infos, for (size_t i = 0; i < wallets.size(); ++i) { - EXPECT_TRUE(intermediate_infos[i].empty()); + EXPECT_TRUE(!intermediate_infos[i].empty()); bool ready; uint32_t threshold, total; EXPECT_TRUE(wallets[i].multisig(&ready, &threshold, &total)); @@ -171,7 +171,7 @@ static void make_wallets(std::vector<tools::wallet2>& wallets, unsigned int M) { ASSERT_TRUE(wallets.size() > 1 && wallets.size() <= KEYS_COUNT); ASSERT_TRUE(M <= wallets.size()); - std::uint32_t rounds_required = multisig::multisig_kex_rounds_required(wallets.size(), M); + std::uint32_t total_rounds_required = multisig::multisig_kex_rounds_required(wallets.size(), M) + 1; std::uint32_t rounds_complete{0}; // initialize wallets, get first round multisig kex msgs @@ -203,18 +203,17 @@ static void make_wallets(std::vector<tools::wallet2>& wallets, unsigned int M) ++rounds_complete; // perform kex rounds until kex is complete - while (!intermediate_infos[0].empty()) + bool ready; + wallets[0].multisig(&ready); + while (!ready) { - bool ready{false}; - wallets[0].multisig(&ready); - EXPECT_FALSE(ready); - intermediate_infos = exchange_round(wallets, intermediate_infos); + wallets[0].multisig(&ready); ++rounds_complete; } - EXPECT_EQ(rounds_required, rounds_complete); + EXPECT_EQ(total_rounds_required, rounds_complete); check_results(intermediate_infos, wallets, M); } |