Add CuckooCache implementation and replace the sigcache map_type with it

SQUASHME: Change cuckoocache to only work for powers of two, to avoid mod operator
SQUASHME: Update Documentation and simplify logarithm logic
SQUASHME: OSX Build Errors
SQUASHME: minor Feedback from sipa + bluematt
SQUASHME: DOCONLY: Clarify a few comments.
This commit is contained in:
Jeremy Rubin
2016-10-05 16:58:47 -04:00
parent 7942d31d5f
commit c9e69fbf39
5 changed files with 507 additions and 42 deletions

View File

@@ -10,9 +10,10 @@
#include <vector>
// DoS prevention: limit cache size to less than 40MB (over 500000
// entries on 64-bit systems).
static const unsigned int DEFAULT_MAX_SIG_CACHE_SIZE = 40;
// DoS prevention: limit cache size to 32MB (over 1000000 entries on 64-bit
// systems). Due to how we count cache size, actual memory usage is slightly
// more (~32.25 MB)
static const unsigned int DEFAULT_MAX_SIG_CACHE_SIZE = 32;
class CPubKey;
@@ -27,4 +28,6 @@ public:
bool VerifySignature(const std::vector<unsigned char>& vchSig, const CPubKey& vchPubKey, const uint256& sighash) const;
};
void InitSignatureCache();
#endif // BITCOIN_SCRIPT_SIGCACHE_H