mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-09 20:23:35 +01:00
[checkqueue] support user-defined return type through std::optional
The check type function now needs to return a std::optional<R> for some type R, and the check queue overall will return std::nullopt if all individual checks return that, or one of the non-nullopt values if there is at least one. For most tests, we use R=int, but for the actual validation code, we make it return the ScriptError.
This commit is contained in:
@@ -34,9 +34,9 @@ static void CCheckQueueSpeedPrevectorJob(benchmark::Bench& bench)
|
||||
explicit PrevectorJob(FastRandomContext& insecure_rand){
|
||||
p.resize(insecure_rand.randrange(PREVECTOR_SIZE*2));
|
||||
}
|
||||
bool operator()()
|
||||
std::optional<int> operator()()
|
||||
{
|
||||
return true;
|
||||
return std::nullopt;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -62,7 +62,7 @@ static void CCheckQueueSpeedPrevectorJob(benchmark::Bench& bench)
|
||||
}
|
||||
// control waits for completion by RAII, but
|
||||
// it is done explicitly here for clarity
|
||||
control.Wait();
|
||||
control.Complete();
|
||||
});
|
||||
}
|
||||
BENCHMARK(CCheckQueueSpeedPrevectorJob, benchmark::PriorityLevel::HIGH);
|
||||
|
||||
Reference in New Issue
Block a user