multi: add random coin selection
This commit is contained in:
10 files changed
+63
-22
No files matched your search
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user