mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
Merge #14885: rpc: Assert named arguments are unique in RPCHelpMan
e09a5875ca rpc: Assert named arguments are unique in RPCHelpMan (João Barbosa) Pull request description: Prevents an obvious mistake. Tree-SHA512: 32c24a1934b17ab6f0d5cd31bdf0388e93ee5156ccc1b4f78eb9fd7f1d4b27a4b978b594ff11812bc9f20987c9fc36bf4497ddaedf18cf6bcbea19c050571334
This commit is contained in:
parent
bbb9949dc1
commit
de06e3164b
@ -219,6 +219,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 RPCHelpMan::ToString() const
|
||||||
{
|
{
|
||||||
std::string ret;
|
std::string ret;
|
||||||
|
@ -119,10 +119,7 @@ struct RPCArg {
|
|||||||
class RPCHelpMan
|
class RPCHelpMan
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RPCHelpMan(const std::string& name, const std::string& description, const std::vector<RPCArg>& args)
|
RPCHelpMan(const std::string& name, const std::string& description, const std::vector<RPCArg>& args);
|
||||||
: m_name{name}, m_description{description}, m_args{args}
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string ToString() const;
|
std::string ToString() const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user