Compute the vector where each element is SHA256 of scriptPubKeys spent by a tx. */
| 2498 | |
| 2499 | /** Compute the vector where each element is SHA256 of scriptPubKeys spent by a tx. */ |
| 2500 | std::vector<uint256> GetSpentScriptPubKeysSHA256(const std::vector<CTxOut>& outputs_spent) |
| 2501 | { |
| 2502 | std::vector<uint256> spent_spk_single_hashes; |
| 2503 | spent_spk_single_hashes.reserve(outputs_spent.size()); |
| 2504 | for (const auto& txout : outputs_spent) { |
| 2505 | // Normal serialization using the << operator would also serialize the length, therefore we directly write using CSHA256 |
| 2506 | uint256 spent_spk_single_hash; |
| 2507 | CSHA256().Write(txout.scriptPubKey.data(), txout.scriptPubKey.size()).Finalize(spent_spk_single_hash.data()); |
| 2508 | spent_spk_single_hashes.push_back(std::move(spent_spk_single_hash)); |
| 2509 | } |
| 2510 | return spent_spk_single_hashes; |
| 2511 | } |
| 2512 | |
| 2513 | /** Compute the vector where each element is SHA256 of output scriptPubKey of a tx. */ |
| 2514 | template <class T> |