multi: add random coin selection

This commit is contained in:
Joost Jager committed 2021-05-24 20:09:56 +02:00
1 parent 4f98cea820
commit 42f4afef75
10 files changed
+63 -22

No files matched your search

+8 -3
View File
@@ -647,7 +647,8 @@ func (b *BtcWallet) SendOutputs(outputs []*wire.TxOut,
}
return b.wallet.SendOutputs(
outputs, nil, defaultAccount, minConfs, feeSatPerKB, label,
outputs, nil, defaultAccount, minConfs, feeSatPerKB,
b.cfg.CoinSelectionStrategy, label,
)
}
@@ -697,7 +698,8 @@ func (b *BtcWallet) CreateSimpleTx(outputs []*wire.TxOut,
}
return b.wallet.CreateSimpleTx(
nil, defaultAccount, outputs, minConfs, feeSatPerKB, dryRun,
nil, defaultAccount, outputs, minConfs, feeSatPerKB,
b.cfg.CoinSelectionStrategy, dryRun,
)
}
@@ -1100,7 +1102,10 @@ func (b *BtcWallet) FundPsbt(packet *psbt.Packet,
// Let the wallet handle coin selection and/or fee estimation based on
// the partial TX information in the packet.
return b.wallet.FundPsbt(packet, keyScope, accountNum, feeSatPerKB)
return b.wallet.FundPsbt(
packet, keyScope, accountNum, feeSatPerKB,
b.cfg.CoinSelectionStrategy,
)
}
// FinalizePsbt expects a partial transaction with all inputs and outputs fully
+4
View File
@@ -74,6 +74,10 @@ type Config struct {
// LoaderOptions holds functional wallet db loader options.
LoaderOptions []LoaderOption
// CoinSelectionStrategy is the strategy that is used for selecting
// coins when funding a transaction.
CoinSelectionStrategy wallet.CoinSelectionStrategy
}
// NetworkDir returns the directory name of a network directory to hold wallet
+3 -1
View File
@@ -250,7 +250,9 @@ func (w *WalletAssembler) ProvisionChannel(r *Request) (Intent, error) {
"sat/kw as fee rate", int64(r.FeeRate))
// Find all unlocked unspent witness outputs that satisfy the
// minimum number of confirmations required.
// minimum number of confirmations required. Coin selection in
// this function currently ignores the configured coin selection
// strategy.
coins, err := w.cfg.CoinSource.ListCoins(
r.MinConfs, math.MaxInt32,
)