Browse Source

wallet: Use newindex primitive to generate change key index

Signed-off-by: Christian Decker <decker.christian@gmail.com>
ppa-0.6.1
Christian Decker 7 years ago
parent
commit
e4e9e22fe8
  1. 4
      lightningd/build_utxos.c

4
lightningd/build_utxos.c

@ -15,7 +15,6 @@ const struct utxo **build_utxos(const tal_t *ctx,
u64 *change_satoshis, u32 *change_keyindex)
{
u64 fee_estimate = 0;
u64 bip32_max_index = db_get_intvar(ld->wallet->db, "bip32_max_index", 0);
const struct utxo **utxos =
wallet_select_coins(ctx, ld->wallet, satoshi_out, feerate_per_kw,
outputscriptlen,
@ -30,8 +29,7 @@ const struct utxo **build_utxos(const tal_t *ctx,
*change_satoshis = 0;
*change_keyindex = 0;
} else {
*change_keyindex = bip32_max_index + 1;
db_set_intvar(ld->wallet->db, "bip32_max_index", *change_keyindex);
*change_keyindex = wallet_get_newindex(ld);
}
return utxos;
}

Loading…
Cancel
Save