lnwallet: expose optional account filter for several WalletController methods

This commit is contained in:
Wilmer Paulino
2021-02-19 17:41:50 -08:00
parent f38bf4d7fa
commit f91e7cde59
14 changed files with 138 additions and 76 deletions

View File

@@ -99,9 +99,10 @@ func DetermineFeePerKw(feeEstimator chainfee.Estimator,
// UtxoSource is an interface that allows a caller to access a source of UTXOs
// to use when crafting sweep transactions.
type UtxoSource interface {
// ListUnspentWitness returns all UTXOs from the source that have
// between minConfs and maxConfs number of confirmations.
ListUnspentWitness(minConfs, maxConfs int32) ([]*lnwallet.Utxo, error)
// ListUnspentWitness returns all UTXOs from the default wallet account
// that have between minConfs and maxConfs number of confirmations.
ListUnspentWitnessFromDefaultAccount(minConfs, maxConfs int32) (
[]*lnwallet.Utxo, error)
}
// CoinSelectionLocker is an interface that allows the caller to perform an
@@ -192,7 +193,7 @@ func CraftSweepAllTx(feeRate chainfee.SatPerKWeight, dustLimit btcutil.Amount,
// Now that we can be sure that no other coin selection
// operations are going on, we can grab a clean snapshot of the
// current UTXO state of the wallet.
utxos, err := utxoSource.ListUnspentWitness(
utxos, err := utxoSource.ListUnspentWitnessFromDefaultAccount(
1, math.MaxInt32,
)
if err != nil {