Warning: be very careful when changing this! assumeutxo and UTXO snapshot validation commitments are reliant on the hash constructed by this function. If the construction of this hash is changed, it will invalidate existing UTXO snapshots. This will not result in any kind of consensus failure, but it will force clients that were expecting to make use of assumeutxo to do traditional IBD instead.
| 50 | //! construction could cause a previously invalid (and potentially malicious) |
| 51 | //! UTXO snapshot to be considered valid. |
| 52 | static void ApplyHash(CHashWriter& ss, const uint256& hash, const std::map<uint32_t, Coin>& outputs) |
| 53 | { |
| 54 | for (auto it = outputs.begin(); it != outputs.end(); ++it) { |
| 55 | if (it == outputs.begin()) { |
| 56 | ss << hash; |
| 57 | ss << VARINT(it->second.nHeight * 2 + it->second.fCoinBase ? 1u : 0u); |
| 58 | } |
| 59 | |
| 60 | ss << VARINT(it->first + 1); |
| 61 | ss << it->second.out.scriptPubKey; |
| 62 | ss << it->second.out.nValue; |
| 63 | ss << it->second.out.nAsset; |
| 64 | ss << it->second.out.nNonce; |
| 65 | |
| 66 | if (it == std::prev(outputs.end())) { |
| 67 | ss << VARINT(0u); |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | static void ApplyHash(std::nullptr_t, const uint256& hash, const std::map<uint32_t, Coin>& outputs) {} |
| 73 |
no test coverage detected