mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-19 03:57:40 +02:00
chainntnfs: add support to cancel pending registered confirmation
This commit is contained in:
@@ -795,16 +795,19 @@ func (n *NeutrinoNotifier) RegisterConfirmationsNtfn(txid *chainhash.Hash,
|
||||
|
||||
// Construct a notification request for the transaction and send it to
|
||||
// the main event loop.
|
||||
confID := atomic.AddUint64(&n.confClientCounter, 1)
|
||||
confRequest, err := chainntnfs.NewConfRequest(txid, pkScript)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ntfn := &chainntnfs.ConfNtfn{
|
||||
ConfID: atomic.AddUint64(&n.confClientCounter, 1),
|
||||
ConfID: confID,
|
||||
ConfRequest: confRequest,
|
||||
NumConfirmations: numConfs,
|
||||
Event: chainntnfs.NewConfirmationEvent(numConfs),
|
||||
HeightHint: heightHint,
|
||||
Event: chainntnfs.NewConfirmationEvent(numConfs, func() {
|
||||
n.txNotifier.CancelConf(confRequest, confID)
|
||||
}),
|
||||
HeightHint: heightHint,
|
||||
}
|
||||
|
||||
chainntnfs.Log.Infof("New confirmation subscription: %v, num_confs=%v",
|
||||
|
Reference in New Issue
Block a user