refactor: Replace isTrue with get_bool

This makes the code more robust, see previous commit.

In general replacing isTrue with get_bool is not equivalent because
get_bool can throw exceptions, but in this case, exceptions won't happen
because of RPCTypeCheck() and isNull() checks in the preceding code.
pull/26213/head
MarcoFalke 2 years ago
parent fa2cc5d1d6
commit fa0153e609
No known key found for this signature in database
GPG Key ID: CE2B75697E69A548

@ -304,7 +304,7 @@ static RPCHelpMan createrawtransaction()
std::optional<bool> rbf;
if (!request.params[3].isNull()) {
rbf = request.params[3].isTrue();
rbf = request.params[3].get_bool();
}
CMutableTransaction rawTx = ConstructTransaction(request.params[0], request.params[1], request.params[2], rbf);
@ -1449,7 +1449,7 @@ static RPCHelpMan createpsbt()
std::optional<bool> rbf;
if (!request.params[3].isNull()) {
rbf = request.params[3].isTrue();
rbf = request.params[3].get_bool();
}
CMutableTransaction rawTx = ConstructTransaction(request.params[0], request.params[1], request.params[2], rbf);

Loading…
Cancel
Save