The `Assert`/`Assume` macros are implemented via lambda functions to allow the result of the assertion to both be evaluated (and trigger an abort) and be returned without having the expression be evaluated twice.

This causes some ugly namespacing issues though. Because there's a function call, clang's thread safety annotations don't get passed through (as the lambda is unannotated), possibly causing an unnecessary compiler error because the compiler loses track that a mutex is held when a guarded variable is accessed.

It also seems that gcc (but not clang) gets confused about member functions (but not member variables), eg:

```c++
class TestAssert
{
public:
    int variable = 3;
    int test_1(void) { return variable; }
    int test_2(void) {
        auto x = [&]() {
            Assert(test_1() == 3);
        };
        x();
        return ++variable;
    }
};
```

results in:

```
test/util_tests.cpp:91:26: error: cannot call member function ‘int util_tests::TestAssert::test_1()’ without object
   91 |             Assert(test_1() == 3);
```

requiring you to write `Assert(this->test_1() == 3)` instead.
{
    using std::runtime_error::runtime_error;
};
/**
 * Throw a NonFatalCheckError when the condition evaluates to false
 *
 * This should only be used
 * - where the condition is assumed to be true, not for error handling or validating user input
 * - where a failure to fulfill the condition is recoverable and does not abort the program
 *
 * For example in RPC code, where it is undesirable to crash the whole program, this can be generally used to replace
 * asserts or recoverable logic errors. A NonFatalCheckError in RPC code is caught and passed as a string to the RPC
 * caller, which can then report the issue to the developers.
 */
#define CHECK_NONFATAL(condition)                                 \
    do {                                                          \
        if (!(condition)) {                                       \
            throw NonFatalCheckError(                             \
                strprintf("Internal bug detected: '%s'\n"         \
                          "%s:%d (%s)\n"                          \
                          "You may report this issue here: %s\n", \
                    (#condition),                                 \