kevacoin/src/script
Matt Corallo b5fea8d0cc Cache full script execution results in addition to signatures
This adds a new CuckooCache in validation, caching whether all of a
transaction's scripts were valid with a given set of script flags.

Unlike previous attempts at caching an entire transaction's
validity, which have nearly universally introduced consensus
failures, this only caches the validity of a transaction's
scriptSigs. As these are pure functions of the transaction and
data it commits to, this should be much safer.

This is somewhat duplicative with the sigcache, as entries in the
new cache will also have several entries in the sigcache. However,
the sigcache is kept both as ATMP relies on it and because it
prevents malleability-based DoS attacks on the new higher-level
cache. Instead, the -sigcachesize option is re-used - cutting the
sigcache size in half and using the newly freed memory for the
script execution cache.

Transactions which match the script execution cache never even have
entries in the script check thread's workqueue created.

Note that the cache is indexed only on the script execution flags
and the transaction's witness hash. While this is sufficient to
make the CScriptCheck() calls pure functions, this introduces
dependancies on the mempool calculating things such as the
PrecomputedTransactionData object, filling the CCoinsViewCache, etc
in the exact same way as ConnectBlock. I belive this is a reasonable
assumption, but should be noted carefully.

In a rather naive benchmark (reindex-chainstate up to block 284k
with cuckoocache always returning true for contains(),
-assumevalid=0 and a very large dbcache), this connected blocks
~1.7x faster.
2017-06-07 11:02:36 -04:00
..
bitcoinconsensus.cpp Increment MIT Licence copyright header year on files modified in 2016 2016-12-31 11:01:21 -07:00
bitcoinconsensus.h libconsensus: Add input validation of flags 2016-10-20 19:26:36 +02:00
interpreter.cpp Merge #10313: [Consensus] Add constant for maximum stack size 2017-05-23 14:35:52 -07:00
interpreter.h Do not shadow variables (gcc set) 2016-12-05 11:41:46 +01:00
ismine.cpp Refactor: Remove using namespace <xxx> from script/ 2017-03-08 08:08:17 -08:00
ismine.h Increment MIT Licence copyright header year on files modified in 2016 2016-12-31 11:01:21 -07:00
script_error.cpp Increment MIT Licence copyright header year on files modified in 2016 2016-12-31 11:01:21 -07:00
script_error.h Increment MIT Licence copyright header year on files modified in 2016 2016-12-31 11:01:21 -07:00
script.cpp Refactor: Remove using namespace <xxx> from script/ 2017-03-08 08:08:17 -08:00
script.h Add constant for maximum stack size 2017-05-02 13:37:41 -04:00
sigcache.cpp Cache full script execution results in addition to signatures 2017-06-07 11:02:36 -04:00
sigcache.h Deduplicate SignatureCacheHasher 2017-04-12 14:42:41 -07:00
sign.cpp Refactor: Remove using namespace <xxx> from script/ 2017-03-08 08:08:17 -08:00
sign.h Merge #8808: Do not shadow variables (gcc set) 2017-03-03 15:48:53 +01:00
standard.cpp Refactor: Remove using namespace <xxx> from script/ 2017-03-08 08:08:17 -08:00
standard.h Increment MIT Licence copyright header year on files modified in 2016 2016-12-31 11:01:21 -07:00