SKALE-3276 catch error if name already exists

parent 233f7b71
...@@ -250,15 +250,15 @@ getSecretShares(const string &_polyName, const char *_encryptedPolyHex, const ve ...@@ -250,15 +250,15 @@ getSecretShares(const string &_polyName, const char *_encryptedPolyHex, const ve
spdlog::debug("hexEncr DH Key: { }", hexEncrKey.data()); spdlog::debug("hexEncr DH Key: { }", hexEncrKey.data());
spdlog::debug("name to write to db is {}", dhKeyName); spdlog::debug("name to write to db is {}", dhKeyName);
SGXWalletServer::writeDataToDB(dhKeyName, hexEncrKey.data());
string shareG2_name = "shareG2_" + _polyName + "_" + to_string(i) + ":"; string shareG2_name = "shareG2_" + _polyName + "_" + to_string(i) + ":";
spdlog::debug("name to write to db is {}", shareG2_name); spdlog::debug("name to write to db is {}", shareG2_name);
spdlog::debug("s_shareG2: {}", sShareG2.data()); spdlog::debug("s_shareG2: {}", sShareG2.data());
SGXWalletServer::writeDataToDB(shareG2_name, sShareG2.data()); try {
SGXWalletServer::writeDataToDB(dhKeyName, hexEncrKey.data());
SGXWalletServer::writeDataToDB(shareG2_name, sShareG2.data());
} catch (const SGXException&) {}
} }
return result; return result;
......
...@@ -306,6 +306,8 @@ void TestUtils::doDKG(StubClient &c, int n, int t, ...@@ -306,6 +306,8 @@ void TestUtils::doDKG(StubClient &c, int n, int t,
verifVects[i] = c.getVerificationVector(polyName, t, n); verifVects[i] = c.getVerificationVector(polyName, t, n);
CHECK_STATE(verifVects[i]["status"] == 0); CHECK_STATE(verifVects[i]["status"] == 0);
pubEthKeys.append(ethKeys[i]["publicKey"]); pubEthKeys.append(ethKeys[i]["publicKey"]);
REQUIRE_NOTHROW(c.getVerificationVector(polyName, t, n));
} }
for (uint8_t i = 0; i < n; i++) { for (uint8_t i = 0; i < n; i++) {
...@@ -318,6 +320,7 @@ void TestUtils::doDKG(StubClient &c, int n, int t, ...@@ -318,6 +320,7 @@ void TestUtils::doDKG(StubClient &c, int n, int t,
pubShares[i] += TestUtils::convertDecToHex(pubShare); pubShares[i] += TestUtils::convertDecToHex(pubShare);
} }
} }
REQUIRE_NOTHROW(c.getSecretShare(polyNames[i], pubEthKeys, t, n));
} }
int k = 0; int k = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment