Skip to content

Commit 891a205

Browse files
sangbidarustyrussell
authored andcommitted
jsonrpc: fix recover command for BIP86 wallets
The recover command checks if a node has already issued bitcoin addresses before allowing recovery. This check only looked at bip32_max_index, but with BIP86 wallets, newaddr() increments bip86_max_index instead. Also, the recover test asserted on hex but now it's asserting on codex32 instead. We should probably go in and fix the end point. @rustyrussell what do you think?
1 parent e16892b commit 891a205

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lightningd/jsonrpc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ static struct command_result *json_recover(struct command *cmd,
293293
"Only sqlite3 supported for recover command");
294294

295295
/* Check this is an empty node! */
296-
if (db_get_intvar(cmd->ld->wallet->db, "bip32_max_index", 0) != 0) {
296+
if (db_get_intvar(cmd->ld->wallet->db, "bip32_max_index", 0) != 0
297+
|| db_get_intvar(cmd->ld->wallet->db, "bip86_max_index", 0) != 0) {
297298
return command_fail(cmd, RECOVER_NODE_IN_USE,
298299
"Node has already issued bitcoin addresses!");
299300
}

0 commit comments

Comments
 (0)