wallet: add minimum confirmation parameter to FundPsbt

Setting the minimum confirmation is used for the coin selection when no inputs are provided.
This commit is contained in:
Bjarne Magnussen 2021-09-23 13:40:06 +02:00 committed by Roy Lee
parent b218504ca9
commit 9f1eb98666
2 changed files with 3 additions and 3 deletions

View file

@ -41,7 +41,7 @@ import (
// selected/validated inputs by this method. It is in the caller's // selected/validated inputs by this method. It is in the caller's
// responsibility to lock the inputs before handing the partial transaction out. // responsibility to lock the inputs before handing the partial transaction out.
func (w *Wallet) FundPsbt(packet *psbt.Packet, keyScope *waddrmgr.KeyScope, func (w *Wallet) FundPsbt(packet *psbt.Packet, keyScope *waddrmgr.KeyScope,
account uint32, feeSatPerKB btcutil.Amount, minConfs int32, account uint32, feeSatPerKB btcutil.Amount,
coinSelectionStrategy CoinSelectionStrategy) (int32, error) { coinSelectionStrategy CoinSelectionStrategy) (int32, error) {
// Make sure the packet is well formed. We only require there to be at // Make sure the packet is well formed. We only require there to be at
@ -138,7 +138,7 @@ func (w *Wallet) FundPsbt(packet *psbt.Packet, keyScope *waddrmgr.KeyScope,
// includes everything we need, specifically fee estimation and // includes everything we need, specifically fee estimation and
// change address creation. // change address creation.
tx, err = w.CreateSimpleTx( tx, err = w.CreateSimpleTx(
keyScope, account, packet.UnsignedTx.TxOut, 1, keyScope, account, packet.UnsignedTx.TxOut, minConfs,
feeSatPerKB, coinSelectionStrategy, false, feeSatPerKB, coinSelectionStrategy, false,
) )
if err != nil { if err != nil {

View file

@ -234,7 +234,7 @@ func TestFundPsbt(t *testing.T) {
tc := tc tc := tc
t.Run(tc.name, func(t *testing.T) { t.Run(tc.name, func(t *testing.T) {
changeIndex, err := w.FundPsbt( changeIndex, err := w.FundPsbt(
tc.packet, nil, 0, tc.feeRateSatPerKB, tc.packet, nil, 1, 0, tc.feeRateSatPerKB,
CoinSelectionLargest, CoinSelectionLargest,
) )