| 18 | #include <vector> |
| 19 | |
| 20 | SignatureCache::SignatureCache(const size_t max_size_bytes) |
| 21 | { |
| 22 | uint256 nonce = GetRandHash(); |
| 23 | // We want the nonce to be 64 bytes long to force the hasher to process |
| 24 | // this chunk, which makes later hash computations more efficient. We |
| 25 | // just write our 32-byte entropy, and then pad with 'E' for ECDSA and |
| 26 | // 'S' for Schnorr (followed by 0 bytes). |
| 27 | static constexpr unsigned char PADDING_ECDSA[32] = {'E'}; |
| 28 | static constexpr unsigned char PADDING_SCHNORR[32] = {'S'}; |
| 29 | m_salted_hasher_ecdsa.Write(nonce.begin(), 32); |
| 30 | m_salted_hasher_ecdsa.Write(PADDING_ECDSA, 32); |
| 31 | m_salted_hasher_schnorr.Write(nonce.begin(), 32); |
| 32 | m_salted_hasher_schnorr.Write(PADDING_SCHNORR, 32); |
| 33 | |
| 34 | const auto [num_elems, approx_size_bytes] = setValid.setup_bytes(max_size_bytes); |
| 35 | LogInfo("Using %zu MiB out of %zu MiB requested for signature cache, able to store %zu elements", |
| 36 | approx_size_bytes >> 20, max_size_bytes >> 20, num_elems); |
| 37 | } |
| 38 | |
| 39 | void SignatureCache::ComputeEntryECDSA(uint256& entry, const uint256& hash, const std::vector<unsigned char>& vchSig, const CPubKey& pubkey) const |
| 40 | { |
nothing calls this directly
no test coverage detected