From 86f28cdc1de8ffeee3ba04c074cb6f474c233979 Mon Sep 17 00:00:00 2001 From: eugene Date: Fri, 16 Jul 2021 15:27:17 -0400 Subject: [PATCH] chainntnfs: skip conf dispatch if ntfn already dispatched This mirrors the logic for the spend case. This prevents a double dispatch scenario when combined with a later commit. Otherwise, the confirmation would linger in the buffer which is not ideal. --- chainntnfs/txnotifier.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/chainntnfs/txnotifier.go b/chainntnfs/txnotifier.go index 2e527cfa4..477d45286 100644 --- a/chainntnfs/txnotifier.go +++ b/chainntnfs/txnotifier.go @@ -872,10 +872,13 @@ func (n *TxNotifier) UpdateConfDetails(confRequest ConfRequest, func (n *TxNotifier) dispatchConfDetails( ntfn *ConfNtfn, details *TxConfirmation) error { - // If no details are provided, return early as we can't dispatch. - if details == nil { - Log.Debugf("Unable to dispatch %v, no details provided", - ntfn.ConfRequest) + // If there are no conf details to dispatch or if the notification has + // already been dispatched, then we can skip dispatching to this + // client. + if details == nil || ntfn.dispatched { + Log.Debugf("Skipping dispatch of conf details(%v) for "+ + "request %v, dispatched=%v", details, ntfn.ConfRequest, + ntfn.dispatched) return nil }