Skip to content

Extension Points

Modifications to upstream go-ethereum files that wire in ETC/PoW code. Each point is a hook, field, conditional, call, or function added to a file that originally existed in upstream.

Metric Value
Total extension points 95
Files touched 36

Points by kind

Kind Count
field 30
conditional 31
call 21
function 9
const 2
import 2

Struct Fields

# File Name Lines Description Wires To
1 params/config.go ChainConfig ETC fields 497-507 ECIP fork blocks (1017/1041/1099/Spiral), era rounds, DieHard bomb pause, MESS (ECBP-1100) activation/deactivation params/config_etc.go
2 params/config.go Rules.IsEIP160 1410 EIP-160 activation flag in Rules struct — ETC activates EIP-160 independently of EIP-158
3 params/config.go Rules.IsSpiral 1418 Spiral hard fork activation flag in Rules struct — ETC equivalent of Shanghai
4 eth/handler.go handler.isPow 124 Flag for perpetual PoW chains — gates TD-based sync, block fetcher, chain syncer eth/handler_pow.go
5 eth/handler.go handler.forkFilter 121 Fork ID filter for ETC chain identity — rejects incompatible peers core/forkid
6 eth/handler.go handler.messForceEnable/Disable 126-127 MESS emergency override flags propagated from ethconfig eth/sync_mess.go
7 eth/handler.go handler.blockFetcher 136 Block fetcher instance for PoW chains (nil on PoS) eth/handler_pow.go
8 eth/handler.go handler.chainSync 139 PoW chain syncer managing TD-based sync loop (nil on PoS) eth/sync_pow.go
9 eth/handler.go handler.minedBlockSub 144 PoW mined block subscription — subscribed in Start(), unsubscribed in Stop() eth/handler_mining_pow.go
10 eth/peer.go ethPeerInfo.Difficulty 32 Total difficulty field in peer info — exposed in admin_peers for PoW diagnostics
11 eth/downloader/queue.go queue.revokeHook 153 Callback for header request revocation on peer drop eth/downloader/queue_pow.go
12 eth/downloader/downloader.go Downloader.cancelPeer 158 Tracks the master peer for cancellation on stalling — used by concurrent fetchers eth/downloader/downloader_pow.go
13 core/blockchain.go BlockChain.forker 367 ETC PoW fork choice engine (nil for non-PoW) — replaces upstream hc.td comparison core/forkchoice_pow.go
14 core/headerchain.go HeaderChain.tdCache 68 LRU cache for total difficulty values, keyed by block hash core/headerchain_pow.go
15 eth/protocols/eth/peer.go Peer.powExt 86 PoW-specific peer state (TD, head info) — nil for PoS peers eth/protocols/eth/peer_pow.go
16 eth/ethconfig/config.go Config.MESSForceEnable/Disable 226-227 Emergency MESS overrides — force enable or force disable regardless of chain config eth/sync_mess.go
17 eth/ethconfig/config.go Config.Ethash 230 Ethash configuration for ETC PoW mining consensus/ethash
18 ethstats/ethstats.go nodeStats.Mining/Hashrate 818-819 Mining flag and hashrate in the periodic node stats report — restored from the #28623 removal miner/miner_pow.go

Conditional Blocks

# File Name Lines Description Wires To
19 core/genesis.go chainConfigOrDefault Classic guard 463 Prefers a stored Classic/Mordor config over the ETH/ETC shared genesis hash, so a Classic datadir opened without an explicit genesis isn't misresolved to Ethereum mainnet params/config_etc.go
20 eth/handler.go isPow dispatch in runEthPeer 263-281 Routes to Handshake68PoW (with TD) for PoW peers, standard Handshake for PoS eth/protocols/eth/handshake_pow.go
21 eth/handler.go isPow notify chainSync 330-332 Notifies PoW chain syncer about new peer for TD-based sync eth/sync_pow.go
22 eth/handler.go isPow in Start (txFetcher guard) 468-470 Skips txFetcher.Start() for PoW — lifecycle managed by chainSyncer.loop() eth/sync_pow.go
23 eth/handler.go isPow in Start (PoW syncer) 473-486 Starts chainSyncer, block fetcher, and MESS safety loop for PoW chains eth/handler_pow.go, eth/sync_pow.go
24 eth/handler.go isPow in Stop 502-508 Skips manual fetcher/downloader stop for PoW — defers handle teardown eth/sync_pow.go
25 eth/handler_eth.go NewBlockHashesPacket PoW dispatch 62-64 Dispatches NewBlockHashes to block fetcher for PoW announcement-based propagation eth/handler_pow.go
26 eth/handler_eth.go NewBlockPacket PoW dispatch 66-67 Dispatches NewBlock to block fetcher for PoW block propagation eth/handler_pow.go
27 eth/peer.go PoW block in ethPeer.info() 54-56 Adds difficulty and head hash to peer info when TD is available
28 core/evm.go London-without-EIP1559 baseFee=0 59-61 Sets baseFee to 0 when London is active but EIP-1559 is not — ETC decouples these
29 core/vm/evm.go IsSpiral instruction set 164-165 Selects Spiral instruction set — ETC equivalent of Shanghai EVM rules
30 core/vm/evm.go IsEIP160 activation 192,194-195 Deep-copies jump table and enables EIP-160 (increased gas for EXP) independently
31 consensus/misc/eip1559/eip1559.go IsEIP1559 guard 66 Guards EIP-1559 base fee verification — skips when chain has London without 1559
32 core/blockchain.go forker in writeKnownBlock 1689-1697 Uses ForkChoice.ReorgNeeded() to decide reorg for known blocks core/forkchoice_pow.go
33 core/blockchain.go forker in writeBlockAndSetHead 1835-1843 Uses ForkChoice.ReorgNeeded() to decide reorg for new blocks core/forkchoice_pow.go
34 core/blockchain.go IsPow in NewBlockChain 438-439 Initializes ForkChoice with MESS for PoW chains core/forkchoice_pow.go
35 eth/downloader/queue.go revokeHook in Revoke 498-500 Calls revokeHook callback (if set) to also revoke in-flight header requests eth/downloader/queue_pow.go
36 eth/downloader/fetchers_concurrent.go errNoPeers check 131 Returns errNoPeers when no peers available — triggers master peer cancel flow eth/downloader/downloader_pow.go
37 eth/downloader/fetchers_concurrent.go master peer cancel 317-322 Detects master peer drop and triggers download cancellation via cancelPeer eth/downloader/downloader_pow.go
38 eth/downloader/fetchers.go cancelCh case 48 Listens on cancelCh to abort header fetching when master peer drops eth/downloader/downloader_pow.go
39 eth/backend.go Conditional NewPoW miner creation 383-389 Creates miner with PoW support (miner.NewPoW) for IsPow chains, standard miner.New for PoS miner/miner_pow.go

Function Calls

# File Name Lines Description Wires To
40 params/config.go checkCompatible → checkCompatibleETC 1157 Guards the ETC fork blocks (ECIP-1017/1041/1099, Spiral) against incompatible changes; upstream's enumerated checkCompatible omits them although they enter the fork ID params/config_etc.go
41 params/config.go CheckConfigForkOrder → checkConfigForkOrderETC 945 Validates ETC fork ordering (Gotham/DieHard/Etchash/Spiral interleaved with the shared forks) params/config_etc.go
42 core/rawdb/accessors_chain.go DeleteTd in DeleteBlock 825 Deletes TD when deleting a block (PoS doesn't have TD) core/rawdb/accessors_chain_pow.go
43 core/rawdb/accessors_chain.go DeleteTd in DeleteBlockWithoutNumber 835 Deletes TD in the variant without number lookup core/rawdb/accessors_chain_pow.go
44 core/blockchain.go WriteTd in SetHead reset 1239 Writes genesis TD during chain head reset core/rawdb/accessors_chain_pow.go
45 core/blockchain.go WriteTd for sidechain block 1671-1674 Calculates and writes TD for sidechain (non-canonical) blocks core/rawdb/accessors_chain_pow.go
46 core/blockchain.go WriteTd for canonical block 1722-1725 Calculates and writes TD for blocks inserted into the canonical chain core/rawdb/accessors_chain_pow.go
47 core/headerchain.go TD write in WriteHeaders 228-242 Accumulates TD for every header and writes rawdb.WriteTd/cache for newly inserted headers during header-chain insertion core/rawdb/accessors_pow.go
48 core/rawdb/chain_freezer.go AppendRaw TD in freezeRange 354-361 Appends TD to ancient freezer store during block freezing core/rawdb/ancient_scheme.go
49 core/genesis.go WriteTd in Commit 599 Writes genesis block total difficulty during chain database commit core/rawdb/accessors_chain_pow.go
50 ethstats/ethstats.go GetTd in assembleBlockStats 701,712 Fetches total difficulty for block stats reporting to ethstats server eth/api_backend_pow.go
51 ethstats/ethstats.go Miner Mining/Hashrate in reportStats 837-839 Queries the PoW miner for mining state and hashrate when the backend satisfies miningNodeBackend — verbatim restore of the pre-#28623 hunks eth/api_backend_pow.go
52 internal/ethapi/api.go rpcMarshalHeader in GetHeaderByNumber 497 Calls rpcMarshalHeader to inject totalDifficulty in header response internal/ethapi/api_pow.go
53 internal/ethapi/api.go rpcMarshalHeader in GetHeaderByHash 513 Calls rpcMarshalHeader to inject totalDifficulty in header response internal/ethapi/api_pow.go
54 internal/ethapi/api.go rpcMarshalBlock in GetBlockByNumber 528 Calls rpcMarshalBlock to inject totalDifficulty in block response internal/ethapi/api_pow.go
55 internal/ethapi/api.go rpcMarshalBlock in GetBlockByHash 548 Calls rpcMarshalBlock to inject totalDifficulty in block response internal/ethapi/api_pow.go
56 internal/ethapi/api.go rpcMarshalBlock in GetUncleByBlockNumberAndIndex 563 Calls rpcMarshalBlock to inject totalDifficulty in uncle response internal/ethapi/api_pow.go
57 internal/ethapi/api.go rpcMarshalBlock in GetUncleByBlockHashAndIndex 578 Calls rpcMarshalBlock to inject totalDifficulty in uncle response internal/ethapi/api_pow.go
58 eth/backend.go ResolvePath for ethash CacheDir 201 Resolves ethash cache directory relative to datadir — pre-purge3 did this in CreateConsensusEngine, we do it before CreateConsensusEngineWithConfig. Without this, CacheDir 'etchash' is created relative to CWD (e.g. / under systemd), causing permission errors and OOM from in-memory cache regeneration.
59 eth/backend.go minerUpdate goroutine 386 Launches minerUpdate goroutine for PoW chains — coordinates mining pause/resume with downloader sync events eth/backend_mining_pow.go
60 eth/backend.go CloseMining in Stop 635 Closes PoW mining goroutines before stopping other subsystems miner/miner_pow.go

EIP-1559 Decoupling

# File Name Lines Description Wires To
61 core/chain_makers.go IsEIP1559 in GenerateChain header 246,248 Uses IsEIP1559 instead of IsLondon for base fee initialization in test chain generation
62 core/chain_makers.go IsEIP1559 in makeHeader 518,520 Uses IsEIP1559 instead of IsLondon for base fee calculation in test header construction
63 core/state_transition.go IsEIP1559 in gas price 528 Uses IsEIP1559 instead of IsLondon to determine effective gas price calculation
64 core/txpool/legacypool/legacypool.go IsEIP1559 in pool reset 1263 Uses IsEIP1559 instead of IsLondon for base fee tracking in transaction pool
65 eth/gasprice/feehistory.go IsEIP1559 in fee history 92 Uses IsEIP1559 instead of IsLondon for fee history base fee resolution
66 graphql/graphql.go IsEIP1559 in GraphQL baseFee 785 Uses IsEIP1559 instead of IsLondon for GraphQL base fee next-block estimation
67 internal/ethapi/simulate.go IsEIP1559 in simulation 263 Uses IsEIP1559 instead of IsLondon for base fee in block simulation
68 internal/ethapi/transaction_args.go IsEIP1559 in tx args 215 Uses IsEIP1559 instead of IsLondon for gas tip cap defaults in transaction arguments
69 miner/worker.go IsEIP1559 in miner 290,292 Uses IsEIP1559 instead of IsLondon for base fee initialization in block preparation

Constants & Variables

# File Name Lines Description Wires To
70 core/rawdb/ancient_scheme.go ChainFreezerDifficultyTable 43-44 Declares 'diffs' freezer table for storing total difficulty in ancient store
71 core/rawdb/ancient_scheme.go Difficulty table in freezer schema 71 Registers the diffs (total-difficulty) table in chainFreezerTableConfigs — uncompressed (noSnappy: true, same as core-geth), non-prunable
72 core/headerchain.go tdCacheLimit 39 LRU cache size constant (1024) for TD values
73 eth/downloader/downloader.go errStallingPeer etc. 74 Error variables for PoW sync — errStallingPeer, errNoPeers, errCanceled
74 eth/downloader/metrics.go headerDropMeter 28 Meter tracking dropped headers during PoW sync
75 params/bootnodes_etc.go ClassicBootnodes, MordorBootnodes 19-34 Bootstrap node lists for ETC mainnet and Mordor testnet
76 params/bootnodes_etc.go etcDNSPrefix + DNS discovery 37,45-46,47-48 DNS discovery prefix and tree URLs for ETC mainnet and Mordor

Added Functions

# File Name Lines Description Wires To
77 eth/ethconfig/config.go CreateConsensusEngineWithConfig 246-268 Consensus engine routing by config shape — any perpetual PoW config (IsPow) gets the ETCEngine, merge-track configs get the beacon wrapper consensus/etc
78 eth/peer.go KnownBlock, AsyncSendNewBlock, AsyncSendNewBlockHash 72-73,78-79,84-85 PoW block propagation helpers — track known blocks and async broadcast to peers eth/handler_pow.go
79 core/vm/eips.go enable160 171-175 Enables EIP-160 (EXP gas increase) independently — ETC activates separately from EIP-158

Interface Additions

# File Name Lines Description Wires To
80 eth/downloader/downloader.go BlockChain.GetTd 191-192 GetTd method added to BlockChain interface — required for TD-based PoW sync core/blockchain_pow.go
81 eth/downloader/peer.go Peer.Head() 60 Head() method in Peer interface — returns head hash and TD for PoW peer selection eth/protocols/eth/peer_pow.go
82 ethstats/ethstats.go backend.GetTd 70 GetTd method added to ethstats backend interface — used for block stats reporting eth/api_backend_pow.go
83 ethstats/ethstats.go miningNodeBackend 86-89 Mining-node backend interface (fullNodeBackend + Miner) — restored from the #28623 removal, satisfied by EthAPIBackend via the revived Miner accessor eth/api_backend_pow.go
84 internal/ethapi/backend.go GetTd in Backend interface 74 Interface method for fetching total difficulty by block hash — removed in PR #30386, restored for ETC eth/api_backend_pow.go

Import Additions

# File Name Lines Description Wires To
85 eth/ethconfig/config.go consensus/etc and consensus/ethash imports 28-29 Adds imports for ETC consensus engine and Ethash configuration consensus/etc, consensus/ethash
86 ethstats/ethstats.go miner import 42 Adds the miner package import for the restored miningNodeBackend interface miner/miner_pow.go

Config Plumbing

# File Name Lines Description Wires To
87 eth/handler.go handlerConfig.IsPow 113 Config field that propagates IsPow flag from ethconfig to handler eth/backend.go
88 eth/handler.go isPow initialization 173-175 Copies config.IsPow into handler struct during construction
89 eth/backend.go IsPow passthrough 374 Passes IsPow from blockchain config to handler config eth/handler.go
90 eth/backend.go MESS flags passthrough 375-376 Passes MESSForceEnable/Disable from ethconfig to handler config eth/handler.go
91 eth/backend.go etherbase seed in New 384 Seeds the mining etherbase from Miner.PendingFeeRecipient at backend construction — restored from the #28623 removal (etherbase: config.Miner.Etherbase); without it --mine dies at startup with 'etherbase missing' eth/backend_mining_pow.go
92 eth/backend.go isPow to MakeProtocols 490 Passes isPow flag to eth.MakeProtocols for protocol version selection eth/protocols/eth/handler.go
93 eth/protocols/eth/handler.go MakeProtocols versions param 108 MakeProtocols accepts versions []uint param to select protocol versions for PoW eth/protocols/eth/protocol_pow.go
94 eth/protocols/eth/handler.go versionHandlers registry 175-177 Map[uint]map[uint64]msgHandler{} — runtime registry for version-specific message handlers (ETH68 PoW handlers registered via init()) eth/protocols/eth/handlers_pow.go
95 eth/protocols/eth/handler.go versionHandlers dispatch 245-246 Fallback dispatch in handleMessage — checks versionHandlers map for version-specific handlers (ETH68 PoW messages) eth/protocols/eth/handlers_pow.go