mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 22:25:24 +01:00
chainntnfs: acquire TxNotifier lock after closing quit chan
This prevents a deadlock while tearing down the TxNotifier if it's currently blocked delivering a notification. By closing the quit chan first, we ensure blocked sends/reads can exit and allow the TxNotifier to proceed tearing down.
This commit is contained in:
parent
17b6205f3a
commit
cb1d6683d9
1 changed files with 2 additions and 2 deletions
|
@ -1912,11 +1912,11 @@ func (n *TxNotifier) dispatchSpendReorg(ntfn *SpendNtfn) error {
|
|||
// closes the event channels of all registered notifications that have not been
|
||||
// dispatched yet.
|
||||
func (n *TxNotifier) TearDown() {
|
||||
close(n.quit)
|
||||
|
||||
n.Lock()
|
||||
defer n.Unlock()
|
||||
|
||||
close(n.quit)
|
||||
|
||||
for _, confSet := range n.confNotifications {
|
||||
for _, ntfn := range confSet.ntfns {
|
||||
close(ntfn.Event.Confirmed)
|
||||
|
|
Loading…
Add table
Reference in a new issue