forked from cheng/wallet
moved a large array from stack to dynamic allocation, and fixed unit
test to correctly handle the new database schema
This commit is contained in:
parent
408942a336
commit
23e95c16ba
@ -187,7 +187,7 @@ static bool checkDataConversionsProduceExpected(void){
|
||||
point pt_a{ scl_b.timesBase() };
|
||||
std::string str_pt_a{ &(base58(pt_a))[0] };
|
||||
if (pt_a != base58<point>::bin(str_pt_a.c_str())){
|
||||
MyException("Round trip from and two base 58 representation failed");
|
||||
throw MyException("Round trip from and two base 58 representation failed");
|
||||
}
|
||||
}
|
||||
{
|
||||
@ -397,15 +397,11 @@ static bool OpenWallet(void) {
|
||||
sql_read_name read_name(db.get());
|
||||
// db.reset(nullptr);// Force error of premature destruction of Isqlite3
|
||||
while (read_keys.step() == Icompiled_sql::ROW) {
|
||||
auto pubkey = read_keys.column<ristretto255::point>(0);
|
||||
auto id = read_keys.column<int>(1);
|
||||
auto use = read_keys.column<int>(2);
|
||||
if (use != 1){
|
||||
throw MyException(R"|(Unknown secret key algorithm index in "Names" table)|");
|
||||
}
|
||||
if (!read_name(id)){
|
||||
throw MyException(R"|(No entry corresponding to public key in "Names" table)|");
|
||||
}
|
||||
auto pubkey = read_keys.column<ristretto255::point>(1);
|
||||
auto id = read_keys.column<int>(2);
|
||||
auto use = read_keys.column<int>(3);
|
||||
if (use != 1)throw MyException(sz_unknown_secret_key_algorithm);
|
||||
if (!read_name(id)) throw MyException(sz_no_corresponding_entry);
|
||||
const char* name = read_name.name();
|
||||
if(MasterSecret(name).timesBase()!=*pubkey)throw MyException(R"|(Public key of name fails to correspond)|");
|
||||
wxLogMessage(wxT("\t\t\"%s\" has expected public key 0x%s"), name, (wxString)(bin2hex(*pubkey)));
|
||||
@ -923,10 +919,12 @@ static bool TestShareSecretGenerationSpeed(void) {
|
||||
}
|
||||
}
|
||||
}
|
||||
uint8_t buff[hashes * 3 * 64];
|
||||
randombytes_buf(std::span<byte>(buff));
|
||||
{
|
||||
std::unique_ptr<uint8_t[]> uBuff = std::make_unique<uint8_t[]>(hashes * 3 * 64);
|
||||
auto sBuff = std::span<uint8_t>(uBuff.get(), hashes * 3 * 64);
|
||||
randombytes_buf(sBuff);
|
||||
start_time = std::chrono::high_resolution_clock::now();
|
||||
c = hash(buff);
|
||||
c = hash(sBuff);
|
||||
end_time = std::chrono::high_resolution_clock::now();
|
||||
time_taken = std::chrono::duration_cast<std::chrono::microseconds> (end_time - start_time);
|
||||
{ bool f = false; //dont optimize pointless calculation away
|
||||
@ -936,6 +934,8 @@ static bool TestShareSecretGenerationSpeed(void) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (const std::exception & e) {
|
||||
errorCode = 10;
|
||||
|
Loading…
Reference in New Issue
Block a user