diff --git a/lnwallet/wallet.go b/lnwallet/wallet.go index 2b41aedc7..6126fa15c 100644 --- a/lnwallet/wallet.go +++ b/lnwallet/wallet.go @@ -377,6 +377,16 @@ func (l *LightningWallet) Shutdown() error { return nil } +// ConfirmedBalance returns the current confirmed balance of the wallet. This +// methods wraps the interal WalletController method so we're able to properly +// hold the coin select mutex while we compute the balance. +func (l *LightningWallet) ConfirmedBalance(confs int32) (btcutil.Amount, error) { + l.coinSelectMtx.Lock() + defer l.coinSelectMtx.Unlock() + + return l.WalletController.ConfirmedBalance(confs) +} + // LockedOutpoints returns a list of all currently locked outpoint. func (l *LightningWallet) LockedOutpoints() []*wire.OutPoint { outPoints := make([]*wire.OutPoint, 0, len(l.lockedOutPoints))