Skip to content

Commit

Permalink
db: migrate old shutdown_keyidx_local -1 values onto key 0.
Browse files Browse the repository at this point in the history
It would be better to give them unique values, but we don't fully support
db migrate anyway and this is simple (though they will end up using the
same key for multiple channel closes if created before this commit).

Note that even if bip32_max_index is currently unset, it defaults to 0
so it will be found.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell authored and cdecker committed Mar 7, 2018
1 parent 6c1233d commit f8c8d55
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions wallet/db.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ char *dbmigrations[] = {
/* Necessary index for long rollbacks of the blockchain, otherwise we're
* doing table scans for every block removed. */
"CREATE INDEX utxoset_spend ON utxoset (spendheight)",
/* Assign key 0 to unassigned shutdown_keyidx_local. */
"UPDATE channels SET shutdown_keyidx_local=0 WHERE shutdown_keyidx_local = -1;",
/* FIXME: We should rename shutdown_keyidx_local to final_key_index */
NULL,
};

Expand Down

0 comments on commit f8c8d55

Please sign in to comment.