lnwallet: ensure ConfirmedBalance holds the coin select mutex
In this commit, we make a new wrapper method around the internal `WalletController` method to ensure it holds the coin select mutex while the balance is being computed.
This commit is contained in:
parent
bb2e7358cf
commit
e860a9e23d
@ -377,6 +377,16 @@ func (l *LightningWallet) Shutdown() error {
|
|||||||
return nil
|
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.
|
// LockedOutpoints returns a list of all currently locked outpoint.
|
||||||
func (l *LightningWallet) LockedOutpoints() []*wire.OutPoint {
|
func (l *LightningWallet) LockedOutpoints() []*wire.OutPoint {
|
||||||
outPoints := make([]*wire.OutPoint, 0, len(l.lockedOutPoints))
|
outPoints := make([]*wire.OutPoint, 0, len(l.lockedOutPoints))
|
||||||
|
Loading…
Reference in New Issue
Block a user