aboutsummaryrefslogtreecommitdiff
path: root/src/Makefile.am
diff options
context:
space:
mode:
authorfurszy <matiasfurszyfer@protonmail.com>2022-04-08 16:24:46 -0300
committerfurszy <matiasfurszyfer@protonmail.com>2022-07-08 11:18:35 -0300
commit7a45c33d1f8a758850cf8e7bd6ad508939ba5c0d (patch)
treef5fe1620b112bfbf121cbf1daebc5d6f441d063d /src/Makefile.am
parentb9f9ed4640f8064a0606755cd1f16ad5dbb0ee06 (diff)
downloadbitcoin-7a45c33d1f8a758850cf8e7bd6ad508939ba5c0d.tar.xz
Introduce generic 'Result' class
Useful to encapsulate the function result object (in case of having it) or, in case of failure, the failure reason. This let us clean lot of boilerplate code, as now instead of returning a boolean and having to add a ref arg for the return object and another ref for the error string. We can simply return a 'BResult<Obj>'. Example of what we currently have: ``` bool doSomething(arg1, arg2, arg3, arg4, &result, &error_string) { do something... if (error) { error_string = "something bad happened"; return false; } result = goodResult; return true; } ``` Example of what we will get with this commit: ``` BResult<Obj> doSomething(arg1, arg2, arg3, arg4) { do something... if (error) return {"something happened"}; // good return {goodResult}; } ``` This allows a similar boilerplate cleanup on the function callers side as well. They don't have to add the extra pre-function-call error string and result object declarations to pass the references to the function.
Diffstat (limited to 'src/Makefile.am')
-rw-r--r--src/Makefile.am1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 3fbbe180fc..a9e9db0a7d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -277,6 +277,7 @@ BITCOIN_CORE_H = \
util/overloaded.h \
util/rbf.h \
util/readwritefile.h \
+ util/result.h \
util/serfloat.h \
util/settings.h \
util/sock.h \