Skip to content

Commit

Permalink
wallet: Use newindex primitive to generate change key index
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Decker <[email protected]>
  • Loading branch information
cdecker committed Jan 8, 2018
1 parent 3e0efb6 commit e4e9e22
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lightningd/build_utxos.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
}

0 comments on commit e4e9e22

Please sign in to comment.