MCPcopy Create free account
hub / github.com/ElementsProject/elements / GetOutputScriptPubKeysSHA256

Function GetOutputScriptPubKeysSHA256

src/script/interpreter.cpp:2515–2526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2513/** Compute the vector where each element is SHA256 of output scriptPubKey of a tx. */
2514template <class T>
2515std::vector<uint256> GetOutputScriptPubKeysSHA256(const T& txTo)
2516{
2517 std::vector<uint256> out_spk_single_hashes;
2518 out_spk_single_hashes.reserve(txTo.vout.size());
2519 for (const auto& txout : txTo.vout) {
2520 // Normal serialization using the << operator would also serialize the length, therefore we directly write using CSHA256
2521 uint256 out_spk_single_hash;
2522 CSHA256().Write(txout.scriptPubKey.data(), txout.scriptPubKey.size()).Finalize(out_spk_single_hash.data());
2523 out_spk_single_hashes.push_back(std::move(out_spk_single_hash));
2524 }
2525 return out_spk_single_hashes;
2526}
2527
2528template <class T>
2529uint256 GetRangeproofsHash(const T& txTo) {

Callers 1

InitMethod · 0.85

Calls 7

CSHA256Class · 0.85
reserveMethod · 0.45
sizeMethod · 0.45
FinalizeMethod · 0.45
WriteMethod · 0.45
dataMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected