Add util::Expected (std::expected)

This commit is contained in:
MarcoFalke
2025-12-04 15:54:19 +01:00
parent e68517208b
commit fa114be27b
9 changed files with 181 additions and 14 deletions

View File

@@ -11,6 +11,7 @@
#include <node/txorphanage.h>
#include <protocol.h>
#include <threadsafety.h>
#include <util/expected.h>
#include <validationinterface.h>
#include <atomic>
@@ -101,9 +102,8 @@ public:
*
* @param[in] peer_id The peer id
* @param[in] block_index The blockindex
* @returns std::nullopt if a request was successfully made, otherwise an error message
*/
virtual std::optional<std::string> FetchBlock(NodeId peer_id, const CBlockIndex& block_index) = 0;
virtual util::Expected<void, std::string> FetchBlock(NodeId peer_id, const CBlockIndex& block_index) = 0;
/** Begin running background tasks, should only be called once */
virtual void StartScheduledTasks(CScheduler& scheduler) = 0;