mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-09 14:18:58 +02:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user