mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-26 21:51:27 +02:00
chainntnfs: skip dispatched conf details
We need to check `dispatched` before sending conf details, otherwise the channel `ntfn.Event.Confirmed` will be blocking, which is the leftover from #9275.
This commit is contained in:
@@ -1757,10 +1757,6 @@ func (n *TxNotifier) NotifyHeight(height uint32) error {
|
||||
for ntfn := range n.ntfnsByConfirmHeight[height] {
|
||||
confSet := n.confNotifications[ntfn.ConfRequest]
|
||||
|
||||
Log.Debugf("Dispatching %v confirmation notification for "+
|
||||
"conf_id=%v, %v", ntfn.NumConfirmations, ntfn.ConfID,
|
||||
ntfn.ConfRequest)
|
||||
|
||||
// The default notification we assigned above includes the
|
||||
// block along with the rest of the details. However not all
|
||||
// clients want the block, so we make a copy here w/o the block
|
||||
@@ -1770,6 +1766,20 @@ func (n *TxNotifier) NotifyHeight(height uint32) error {
|
||||
confDetails.Block = nil
|
||||
}
|
||||
|
||||
// If the `confDetails` has already been sent before, we'll
|
||||
// skip it and continue processing the next one.
|
||||
if ntfn.dispatched {
|
||||
Log.Debugf("Skipped dispatched conf details for "+
|
||||
"request %v conf_id=%v", ntfn.ConfRequest,
|
||||
ntfn.ConfID)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
Log.Debugf("Dispatching %v confirmation notification for "+
|
||||
"conf_id=%v, %v", ntfn.NumConfirmations, ntfn.ConfID,
|
||||
ntfn.ConfRequest)
|
||||
|
||||
select {
|
||||
case ntfn.Event.Confirmed <- &confDetails:
|
||||
ntfn.dispatched = true
|
||||
|
Reference in New Issue
Block a user