mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
wallet: Use newindex primitive to generate change key index
Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
3e0efb6f8d
commit
e4e9e22fe8
@ -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…
Reference in New Issue
Block a user