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

Function newaddr_inner

wallet/walletrpc.c:109–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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