diff options
author | MarcoFalke <falke.marco@gmail.com> | 2019-11-04 11:33:36 -0500 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2019-11-04 11:33:41 -0500 |
commit | 94a26b192f187cb50bf1ac1775b23f2b03f772b1 (patch) | |
tree | 9bb830fa338f1ab04ea3394e553f61aae5e51b27 /src/rpc/util.cpp | |
parent | 6cb10c14c60084b942975d7d59d0592705ea885f (diff) | |
parent | c98bd13e675fbf5641ed64d551b63aaf55a1a8e9 (diff) | |
download | bitcoin-94a26b192f187cb50bf1ac1775b23f2b03f772b1.tar.xz |
Merge #17318: replace asserts in RPC code with CHECK_NONFATAL and add linter
c98bd13e675fbf5641ed64d551b63aaf55a1a8e9 replace asserts in RPC code with CHECK_NONFATAL and add linter (Adam Jonas)
Pull request description:
- Replace instances of assert in /rpc files and rpcwallet with CHECK_NONFATAL(condition)
- Add a linter to prevent future usage of assert being used in RPC code
ref https://github.com/bitcoin/bitcoin/pull/17192
ACKs for top commit:
practicalswift:
ACK c98bd13e675fbf5641ed64d551b63aaf55a1a8e9 -- diff looks correct
Tree-SHA512: a16036b6bbcca73a5334665f66e17e1756377d582317568291da1d727fc9cf8c84bac9d9bd099534e1be315345336e5f7b66b93793135155f320dc5862a2d875
Diffstat (limited to 'src/rpc/util.cpp')
-rw-r--r-- | src/rpc/util.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index 653b287e97..cfa3509c65 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -428,7 +428,7 @@ RPCHelpMan::RPCHelpMan(std::string name, std::string description, std::vector<RP std::set<std::string> named_args; for (const auto& arg : m_args) { // Should have unique named arguments - assert(named_args.insert(arg.m_name).second); + CHECK_NONFATAL(named_args.insert(arg.m_name).second); } } @@ -620,11 +620,11 @@ std::string RPCArg::ToStringObj(const bool oneline) const case Type::OBJ: case Type::OBJ_USER_KEYS: // Currently unused, so avoid writing dead code - assert(false); + CHECK_NONFATAL(false); // no default case, so the compiler can warn about missing cases } - assert(false); + CHECK_NONFATAL(false); } std::string RPCArg::ToString(const bool oneline) const @@ -661,7 +661,7 @@ std::string RPCArg::ToString(const bool oneline) const // no default case, so the compiler can warn about missing cases } - assert(false); + CHECK_NONFATAL(false); } static std::pair<int64_t, int64_t> ParseRange(const UniValue& value) |