Skip to content

SubscribeChainSideEvent

Source (upstream pre-purge) Current
File core/blockchain_reader.go blockchain_pow.go
Symbol BlockChain.SubscribeChainSideEvent BlockChain.SubscribeChainSideEvent
Ref 368e16f39~1 etc/v1.17.3-full-node

Restores the BlockChain.SubscribeChainSideEvent API that upstream removed in #30601 (purge_events), reimplemented over the fork choice's side-block feed (forker.SubscribeSideBlocks) instead of the old blockchain sideFeed.

3-way merge — purge → getc ← upstream

pre-purge≈ adapted (origin inferred by similarity)fork-only
// SubscribeChainSideEvent registers a subscription for side-block headers
// (uncle candidates) surfaced by the TD-based fork choice. On non-PoW chains,
// where no fork choice is installed, the returned subscription never fires.
func (bc *BlockChain) SubscribeChainSideEvent(ch chan<- ChainSideEvent) event.Subscription {
if bc.forker == nil {
return bc.scope.Track(new(event.Feed).Subscribe(ch))
}
return bc.scope.Track(bc.forker.SubscribeSideBlocks(ch))
core-geth validation — +7 -2 | | | |---|---| | File | [`blockchain_reader.go`](https://github.com/etclabscore/core-geth/blob/v1.12.20/core/blockchain_reader.go) | | Symbol | `BlockChain.SubscribeChainSideEvent` | | Ref | `v1.12.20` |
--- a/core-geth/core/blockchain_reader.go
+++ b/etc/core/blockchain_pow.go
@@ -1,4 +1,9 @@
-// SubscribeChainSideEvent registers a subscription of ChainSideEvent.
+// SubscribeChainSideEvent registers a subscription for side-block headers
+// (uncle candidates) surfaced by the TD-based fork choice. On non-PoW chains,
+// where no fork choice is installed, the returned subscription never fires.
 func (bc *BlockChain) SubscribeChainSideEvent(ch chan<- ChainSideEvent) event.Subscription {
-   return bc.scope.Track(bc.chainSideFeed.Subscribe(ch))
+   if bc.forker == nil {
+       return bc.scope.Track(new(event.Feed).Subscribe(ch))
+   }
+   return bc.scope.Track(bc.forker.SubscribeSideBlocks(ch))
 }

← Total Difficulty (TD)