diff --git a/TestUtils.cpp b/TestUtils.cpp index bc1a6f52..9f790276 100644 --- a/TestUtils.cpp +++ b/TestUtils.cpp @@ -792,7 +792,7 @@ void TestUtils::doDKGV2(StubClient &c, int n, int t, CHECK_STATE(pubBLSKeys[i]["status"] == 0); } - for (int i = 0; i < t; i++) { + for (int i = 0; i < n; i++) { vector pubKeyVect; for (uint8_t j = 0; j < 4; j++) { pubKeyVect.push_back(pubBLSKeys[i]["blsPublicKeyShare"][j].asString()); @@ -802,6 +802,27 @@ void TestUtils::doDKGV2(StubClient &c, int n, int t, pubKeyShares[i + 1] = make_shared(pubKey); } + Json::Value publicSharesJson; + for (int i = 0; i < n; ++i) { + publicSharesJson["publicShares"][i] = pubShares[i]; + } + + auto allPubKeysJson = c.calculateAllBLSPublicKeys(publicSharesJson, t, n); + std::vector allPubKeysFromServer(n); + for (int i = 0; i < n; i++) { + vector pubKeyVect; + for (uint8_t j = 0; j < 4; j++) { + pubKeyVect.push_back(allPubKeysJson[i][j].asString()); + } + BLSPublicKeyShare pubKey(make_shared>(pubKeyVect), t, n); + + allPubKeysFromServer[i] = make_shared(pubKey); + } + + for (size_t i = 0; i < n; ++i) { + BOOST_REQUIRE( allPubKeysFromServer[i] == pubKeyShares[i + 1] ); + } + // create pub key BLSPublicKey blsPublicKey(