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

Function param_newaddr

wallet/walletrpc.c:89–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89static struct command_result *param_newaddr(struct command *cmd,
90 const char *name,
91 const char *buffer,
92 const jsmntok_t *tok,
93 enum addrtype **addrtype)
94{
95 *addrtype = tal(cmd, enum addrtype);
96 if (json_tok_streq(buffer, tok, "bech32"))
97 **addrtype = ADDR_BECH32;
98 else if (!chainparams->is_elements && json_tok_streq(buffer, tok, "p2tr"))
99 **addrtype = ADDR_P2TR;
100 else if (json_tok_streq(buffer, tok, "all"))
101 **addrtype = ADDR_ALL;
102 else
103 return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
104 "'%s' should be 'p2tr', 'bech32', or 'all', not '%.*s'",
105 name, tok->end - tok->start, buffer + tok->start);
106 return NULL;
107}
108
109bool WARN_UNUSED_RESULT newaddr_inner(struct command *cmd, struct pubkey *pubkey, enum addrtype addrtype)
110{

Callers

nothing calls this directly

Calls 2

json_tok_streqFunction · 0.85
command_failFunction · 0.50

Tested by

no test coverage detected