MCPcopy Create free account
hub / github.com/ElementsProject/lightning / args_string

Function args_string

plugins/bcli.c:136–156  ·  view source on GitHub ↗

For printing: simple string of args (no secrets!) */

Source from the content-addressed store, hash-verified

134
135/* For printing: simple string of args (no secrets!) */
136static char *args_string(const tal_t *ctx, const char **args, const char **stdinargs)
137{
138 size_t i;
139 char *ret = tal_strdup(ctx, args[0]);
140
141 for (i = 1; args[i]; i++) {
142 ret = tal_strcat(ctx, take(ret), " ");
143 if (strstarts(args[i], "-rpcpassword")) {
144 ret = tal_strcat(ctx, take(ret), "-rpcpassword=...");
145 } else if (strstarts(args[i], "-rpcuser")) {
146 ret = tal_strcat(ctx, take(ret), "-rpcuser=...");
147 } else {
148 ret = tal_strcat(ctx, take(ret), args[i]);
149 }
150 }
151 for (i = 0; i < tal_count(stdinargs); i++) {
152 ret = tal_strcat(ctx, take(ret), " ");
153 ret = tal_strcat(ctx, take(ret), stdinargs[i]);
154 }
155 return ret;
156}
157
158/* Execute bitcoin-cli with pre-built command and optional stdin args.
159 * Returns result with output and exit status. */

Callers 3

execute_bitcoin_cliFunction · 0.85
bitcoind_failureFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected