File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -710,3 +710,14 @@ A few guidelines for introducing and reviewing new RPC interfaces:
710710 client may be aware of prior to entering a wallet RPC call, we must block
711711 until the wallet is caught up to the chainstate as of the RPC call's entry.
712712 This also makes the API much easier for RPC clients to reason about.
713+
714+ - Be aware of RPC method aliases and generally avoid registering the same
715+ callback function pointer for different RPCs.
716+
717+ - * Rationale* : RPC methods registered with the same function pointer will be
718+ considered aliases and only the first method name will show up in the
719+ ` help ` rpc command list.
720+
721+ - * Exception* : Using RPC method aliases may be appropriate in cases where a
722+ new RPC is replacing a deprecated RPC, to avoid both RPCs confusingly
723+ showing up in the command list.
Original file line number Diff line number Diff line change @@ -165,8 +165,17 @@ class CRPCTable
165165
166166 /* *
167167 * Appends a CRPCCommand to the dispatch table.
168+ *
168169 * Returns false if RPC server is already running (dump concurrency protection).
170+ *
169171 * Commands cannot be overwritten (returns false).
172+ *
173+ * Commands with different method names but the same callback function will
174+ * be considered aliases, and only the first registered method name will
175+ * show up in the help text command listing. Aliased commands do not have
176+ * to have the same behavior. Server and client code can distinguish
177+ * between calls based on method name, and aliased commands can also
178+ * register different names, types, and numbers of parameters.
170179 */
171180 bool appendCommand (const std::string& name, const CRPCCommand* pcmd);
172181};
You can’t perform that action at this time.
0 commit comments