mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-25 14:28:53 +02: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:
@@ -335,7 +335,6 @@ private:
|
||||
unsigned int nIn;
|
||||
unsigned int nFlags;
|
||||
bool cacheStore;
|
||||
ScriptError error{SCRIPT_ERR_UNKNOWN_ERROR};
|
||||
PrecomputedTransactionData *txdata;
|
||||
SignatureCache* m_signature_cache;
|
||||
|
||||
@@ -348,9 +347,7 @@ public:
|
||||
CScriptCheck(CScriptCheck&&) = default;
|
||||
CScriptCheck& operator=(CScriptCheck&&) = default;
|
||||
|
||||
bool operator()();
|
||||
|
||||
ScriptError GetScriptError() const { return error; }
|
||||
std::optional<ScriptError> operator()();
|
||||
};
|
||||
|
||||
// CScriptCheck is used a lot in std::vector, make sure that's efficient
|
||||
|
||||
Reference in New Issue
Block a user