Skip to content

core/blockchain_pow.go — Version Comparison

v1.17.3 v1.17.4
Branch etc/v1.17.3-full-node etc/v1.17.4-full-node
Delta +47 -0 +55 -0

Diff between branches

diff --git a/core/blockchain_pow.go b/core/blockchain_pow.go
index 31001b7c5..7eb283560 100644
--- a/core/blockchain_pow.go
+++ b/core/blockchain_pow.go
@@ -21,9 +21,17 @@ import (

    "github.com/ethereum/go-ethereum/common"
    "github.com/ethereum/go-ethereum/core/rawdb"
+   "github.com/ethereum/go-ethereum/core/types"
    "github.com/ethereum/go-ethereum/event"
 )

+// SetPreserve installs the fork-choice preserve callback; no-op on non-PoW chains.
+func (bc *BlockChain) SetPreserve(preserve func(header *types.Header) bool) {
+   if bc.forker != nil {
+       bc.forker.preserve = preserve
+   }
+}
+
 // GetTd retrieves a block's total difficulty in the canonical chain from the
 // database by hash and number, caching it if found.
 func (bc *BlockChain) GetTd(hash common.Hash, number uint64) *big.Int {
← Back to Version Comparison