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

Function param_newaddr

wallet/walletrpc.c:86–104  ·  view source on GitHub ↗

Extract bool indicating "p2sh-segwit" or "bech32" */

Source from the content-addressed store, hash-verified

84
85/* Extract bool indicating "p2sh-segwit" or "bech32" */
86static struct command_result *param_newaddr(struct command *cmd,
87 const char *name,
88 const char *buffer,
89 const jsmntok_t *tok,
90 enum addrtype **addrtype)
91{
92 *addrtype = tal(cmd, enum addrtype);
93 if (json_tok_streq(buffer, tok, "p2sh-segwit"))
94 **addrtype = ADDR_P2SH_SEGWIT;
95 else if (json_tok_streq(buffer, tok, "bech32"))
96 **addrtype = ADDR_BECH32;
97 else if (json_tok_streq(buffer, tok, "all"))
98 **addrtype = ADDR_ALL;
99 else
100 return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
101 "'%s' should be 'bech32', 'p2sh-segwit' or 'all', not '%.*s'",
102 name, tok->end - tok->start, buffer + tok->start);
103 return NULL;
104}
105
106static struct command_result *json_newaddr(struct command *cmd,
107 const char *buffer,

Callers

nothing calls this directly

Calls 2

json_tok_streqFunction · 0.50
command_failFunction · 0.50

Tested by

no test coverage detected