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

Function newaddr_inner

wallet/walletrpc.c:108–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108bool WARN_UNUSED_RESULT newaddr_inner(struct command *cmd, struct pubkey *pubkey, enum addrtype addrtype)
109{
110 s64 keyidx;
111 bool use_bip86_base = (cmd->ld->bip86_base != NULL);
112
113 /* Get new index - wallet_get_newindex now handles both BIP32 and BIP86 */
114 keyidx = wallet_get_newindex(cmd->ld, addrtype);
115 if (keyidx < 0) return false;
116
117 /* Choose derivation method based on wallet type */
118 if (use_bip86_base) {
119 /* Wallet has mnemonic - use BIP86 derivation */
120 bip86_pubkey(cmd->ld, pubkey, keyidx);
121 } else {
122 /* Legacy wallet - use BIP32 derivation */
123 bip32_pubkey(cmd->ld, pubkey, keyidx);
124 }
125 return true;
126}
127
128
129static struct command_result *json_newaddr(struct command *cmd,

Callers 1

json_newaddrFunction · 0.70

Calls 3

wallet_get_newindexFunction · 0.85
bip86_pubkeyFunction · 0.50
bip32_pubkeyFunction · 0.50

Tested by

no test coverage detected