aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/util.cpp
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2018-12-06 15:37:39 +0000
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2018-12-07 16:26:38 +0000
commite09a5875cac3e691bb9cc8301cb882d63b029cb0 (patch)
treebaa2921a856ff4b86496a44a20e78ad8857f51ca /src/rpc/util.cpp
parente2c473ff75f9ec272ab23e0ee30728b72aecd8f2 (diff)
rpc: Assert named arguments are unique in RPCHelpMan
Diffstat (limited to 'src/rpc/util.cpp')
-rw-r--r--src/rpc/util.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp
index bb1c315bc7..740f8351fe 100644
--- a/src/rpc/util.cpp
+++ b/src/rpc/util.cpp
@@ -242,6 +242,16 @@ struct Sections {
}
};
+RPCHelpMan::RPCHelpMan(const std::string& name, const std::string& description, const std::vector<RPCArg>& args)
+ : m_name{name}, m_description{description}, m_args{args}
+{
+ 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);
+ }
+}
+
std::string RPCHelpMan::ToString() const
{
std::string ret;