Changeset View
Changeset View
Standalone View
Standalone View
src/test/sigcache_tests.cpp
Show First 20 Lines • Show All 172 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(flag_invariants) { | ||||
for (int n = 0; n < 16; n++) { | for (int n = 0; n < 16; n++) { | ||||
std::string strMsg = strprintf("Sigcache testflags %i: xx", n); | std::string strMsg = strprintf("Sigcache testflags %i: xx", n); | ||||
uint256 hashMsg = Hash(strMsg.begin(), strMsg.end()); | uint256 hashMsg = Hash(strMsg.begin(), strMsg.end()); | ||||
std::vector<uint8_t> sig; | std::vector<uint8_t> sig; | ||||
BOOST_CHECK(key1.SignECDSA(hashMsg, sig)); | BOOST_CHECK(key1.SignECDSA(hashMsg, sig)); | ||||
// choose random background flagset to test | // choose random background flagset to test | ||||
uint32_t base_flags = insecure_rand(); | uint32_t base_flags = InsecureRand32(); | ||||
// shouldn't be in cache at start | // shouldn't be in cache at start | ||||
BOOST_CHECK(!testChecker.IsCached(sig, pubkey1, hashMsg, base_flags)); | BOOST_CHECK(!testChecker.IsCached(sig, pubkey1, hashMsg, base_flags)); | ||||
// insert into cache | // insert into cache | ||||
BOOST_CHECK( | BOOST_CHECK( | ||||
testChecker.VerifyAndStore(sig, pubkey1, hashMsg, base_flags)); | testChecker.VerifyAndStore(sig, pubkey1, hashMsg, base_flags)); | ||||
// check that it's in | // check that it's in | ||||
BOOST_CHECK(testChecker.IsCached(sig, pubkey1, hashMsg, base_flags)); | BOOST_CHECK(testChecker.IsCached(sig, pubkey1, hashMsg, base_flags)); | ||||
Show All 22 Lines |