chainparams: add blockhash to AssumeutxoData

This allows us to reference assumeutxo configuration by blockhash as
well as height; this is helpful in future changes when we want to
reference assumeutxo configurations before the block index is loaded.
This commit is contained in:
James O'Beirne
2023-05-25 13:05:27 -04:00
parent c711ca186f
commit 434495a8c1
7 changed files with 49 additions and 49 deletions

View File

@@ -5,7 +5,9 @@
#ifndef BITCOIN_UTIL_VECTOR_H
#define BITCOIN_UTIL_VECTOR_H
#include <functional>
#include <initializer_list>
#include <optional>
#include <type_traits>
#include <utility>
#include <vector>
@@ -67,4 +69,15 @@ inline void ClearShrink(V& v) noexcept
V{}.swap(v);
}
template<typename V, typename L>
inline std::optional<V> FindFirst(const std::vector<V>& vec, const L fnc)
{
for (const auto& el : vec) {
if (fnc(el)) {
return el;
}
}
return std::nullopt;
}
#endif // BITCOIN_UTIL_VECTOR_H