Currently the script cache is purely setlike, however for sigChecks we will need
to remember a transaction's sigChecks count in cache for a few reasons:
- enforcement of a block-level limit means that ConnectBlock needs this info, and since it relies on script cache for speedup, the data must be available in cache.
- when resurrecting txns back into the mempool (after a reorg), we use the script cache but again we need to get the sigchecks count back once again, in order to save it in the mempool structures. (block template construction needs sigchecks count, to satisfy the block level consensus rule)
This turns the script cache into a map with a slightly shorter key (256 -> 240 bits)
and a small value (16 bits) attached for tracking sigchecks.
The stored sigchecks value range of 0-65535 is more than enough for our purposes,
since after sigchecks activation, we will have a standardness rule (the per-input
sigchecks limit in D4617) that ultimately limits density of sigchecks, and since
there is a maximum standard txn size, the most sigchecks possible in a standard
transaction will be ~3030 (~30300 on testnet). Nonstandard transactions can
exceed this greatly (theoretically up to 5 million sigchecks), but we don't
care about them here since they never get inserted into the cache anyway.