Browse Source

wallet: Actually save the correct min_index when creating shachains

If we kill the daemon without performing any commits we ended up with
a 0 instead of UINT48_MAX which was expected.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
ppa-0.6.1
Christian Decker 7 years ago
committed by Rusty Russell
parent
commit
05aaaa1f49
  1. 6
      wallet/wallet.c

6
wallet/wallet.c

@ -243,8 +243,10 @@ bool wallet_shachain_init(struct wallet *wallet, struct wallet_shachain *chain)
{
/* Create shachain */
shachain_init(&chain->chain);
if (!db_exec(__func__, wallet->db,
"INSERT INTO shachains (min_index, num_valid) VALUES (0,0);")) {
if (!db_exec(
__func__, wallet->db,
"INSERT INTO shachains (min_index, num_valid) VALUES (%"PRIu64",0);",
chain->chain.min_index)) {
return false;
}
chain->id = sqlite3_last_insert_rowid(wallet->db->sql);

Loading…
Cancel
Save