core/blockchain_pow.go — Version Comparison
|
v1.16.8 |
v1.17.3 |
| Branch |
etc/v1.16.8-full-node |
etc/v1.17.3-full-node |
| Delta |
+36 -0 |
+47 -0 |
Diff between branches
diff --git a/core/blockchain_pow.go b/core/blockchain_pow.go
index a1d30cc55..31001b7c5 100644
--- a/core/blockchain_pow.go
+++ b/core/blockchain_pow.go
@@ -21,6 +21,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/rawdb"
+ "github.com/ethereum/go-ethereum/event"
)
// GetTd retrieves a block's total difficulty in the canonical chain from the
@@ -34,3 +35,13 @@ func (bc *BlockChain) GetTd(hash common.Hash, number uint64) *big.Int {
func (bc *BlockChain) WriteTd(hash common.Hash, number uint64, td *big.Int) {
rawdb.WriteTd(bc.db, hash, number, td)
}
+
+// 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))
+}
← Back to Version Comparison