core: track newPayloadFeed subscriptions in scope

Wrap SubscribeNewPayloadEvent with bc.scope.Track() to ensure
subscriptions are properly cleaned up on shutdown, consistent
with other BlockChain subscription methods. Also fix typo in
the method's doc comment.
This commit is contained in:
Andrew Davis 2025-12-22 10:43:16 +10:00
parent 63c4383bd2
commit 2382d05fb2
No known key found for this signature in database
GPG key ID: 30AB5B89A109D044

View file

@ -523,9 +523,9 @@ func (bc *BlockChain) SubscribeBlockProcessingEvent(ch chan<- bool) event.Subscr
return bc.scope.Track(bc.blockProcFeed.Subscribe(ch)) return bc.scope.Track(bc.blockProcFeed.Subscribe(ch))
} }
// / SubscribeNewPayloadEvent registers a subscription for NewPayloadEvent. // SubscribeNewPayloadEvent registers a subscription for NewPayloadEvent.
func (bc *BlockChain) SubscribeNewPayloadEvent(ch chan<- NewPayloadEvent) event.Subscription { func (bc *BlockChain) SubscribeNewPayloadEvent(ch chan<- NewPayloadEvent) event.Subscription {
return bc.newPayloadFeed.Subscribe(ch) return bc.scope.Track(bc.newPayloadFeed.Subscribe(ch))
} }
// SendNewPayloadEvent sends a NewPayloadEvent to subscribers. // SendNewPayloadEvent sends a NewPayloadEvent to subscribers.