5#ifndef BITCOIN_SCRIPT_SCRIPTCACHE_H
6#define BITCOIN_SCRIPT_SCRIPTCACHE_H
27 std::array<uint8_t, 28>
data;
67 "ScriptCacheElement should be 32 bytes");
71 template <u
int8_t hash_select>
73 static_assert(hash_select < 8,
"only has 8 hashes available.");
75 const auto &d = k.
data;
77 static_assert(
sizeof(d) == 28,
78 "modify the following if key size changes");
81 static_assert(
sizeof(u) == 4 &&
sizeof(d[0]) == 1,
"basic assumptions");
82 if (hash_select < 7) {
83 std::memcpy(&u, d.data() + 4 * hash_select, 4);
89 arr[0] = d[3] ^ d[7] ^ d[11] ^ d[15];
90 arr[1] = d[6] ^ d[10] ^ d[14] ^ d[18];
91 arr[2] = d[9] ^ d[13] ^ d[17] ^ d[21];
92 arr[3] = d[12] ^ d[16] ^ d[20] ^ d[24];
93 std::memcpy(&u, arr, 4);
A hasher class for SHA-256.
The basic transaction that is broadcasted on the network and contained in blocks.
uint32_t operator()(const ScriptCacheKey &k) const
The script cache is a map using a key/value element, that caches the success of executing a specific ...
ScriptCacheKey & operator=(const ScriptCacheKey &rhs)=default
std::array< uint8_t, 28 > data
ScriptCacheKey(const ScriptCacheKey &rhs)=default
bool operator==(const ScriptCacheKey &rhs) const
static constexpr size_t DEFAULT_SCRIPT_EXECUTION_CACHE_BYTES
In future if many more values are added, it should be considered to expand the element size to 64 byt...
const KeyType & getKey() const
ScriptCacheElement(const KeyType &keyIn, int nSigChecksIn)
ScriptCacheElement()=default