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 90
Files touched 36

Points by kind

Kind Count
field 29
conditional 31
call 20
function 7
const 2
import 1

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 1392 EIP-160 activation flag in Rules struct — ETC activates EIP-160 independently of EIP-158
3 params/config.go Rules.IsSpiral 1398 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/peer.go ethPeerInfo.Difficulty 32 Total difficulty field in peer info — exposed in admin_peers for PoW diagnostics
10 eth/downloader/queue.go queue.revokeHook 153 Callback for header request revocation on peer drop eth/downloader/queue_pow.go
11 eth/downloader/downloader.go Downloader.cancelPeer 155 Tracks the master peer for cancellation on stalling — used by concurrent fetchers eth/downloader/downloader_pow.go
12 core/blockchain.go BlockChain.forker 359 ETC PoW fork choice engine (nil for non-PoW) — replaces upstream hc.td comparison core/forkchoice_pow.go
13 core/headerchain.go HeaderChain.tdCache 68 LRU cache for total difficulty values, keyed by block hash core/headerchain_pow.go
14 eth/protocols/eth/peer.go Peer.powExt 68 PoW-specific peer state (TD, head info) — nil for PoS peers eth/protocols/eth/peer_pow.go
15 eth/ethconfig/config.go Config.MESSForceEnable/Disable 214-215 Emergency MESS overrides — force enable or force disable regardless of chain config eth/ethconfig/config.go
16 eth/ethconfig/config.go Config.Ethash 218 Ethash configuration for ETC PoW mining consensus/ethash

Conditional Blocks

# File Name Lines Description Wires To
17 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
18 eth/handler.go isPow dispatch in runEthPeer 264-282 Routes to Handshake68PoW (with TD) for PoW peers, standard Handshake for PoS eth/protocols/eth/handshake_pow.go
19 eth/handler.go isPow notify chainSync 325-327 Notifies PoW chain syncer about new peer for TD-based sync eth/sync_pow.go
20 eth/handler.go isPow in Start (txFetcher guard) 462-465 Skips txFetcher.Start() for PoW — lifecycle managed by chainSyncer.loop() eth/sync_pow.go
21 eth/handler.go isPow in Start (PoW syncer) 467-477 Starts chainSyncer, block fetcher, and MESS safety loop for PoW chains eth/handler_pow.go, eth/sync_pow.go
22 eth/handler.go isPow in Stop 490-496 Skips manual fetcher/downloader stop for PoW — defers handle teardown eth/sync_pow.go
23 eth/handler_eth.go NewBlockHashesPacket PoW dispatch 62-64 Dispatches NewBlockHashes to block fetcher for PoW announcement-based propagation eth/handler_pow.go
24 eth/handler_eth.go NewBlockPacket PoW dispatch 66-67 Dispatches NewBlock to block fetcher for PoW block propagation eth/handler_pow.go
25 eth/peer.go PoW block in ethPeer.info() 54-56 Adds difficulty and head hash to peer info when TD is available
26 core/evm.go London-without-EIP1559 baseFee=0 58-60 Sets baseFee to 0 when London is active but EIP-1559 is not — ETC decouples these
27 core/vm/evm.go IsSpiral instruction set 159-160 Selects Spiral instruction set — ETC equivalent of Shanghai EVM rules
28 core/vm/evm.go IsEIP160 activation 185,188-189 Deep-copies jump table and enables EIP-160 (increased gas for EXP) independently
29 consensus/misc/eip1559/eip1559.go IsEIP1559 guard 66 Guards EIP-1559 base fee verification — skips when chain has London without 1559
30 core/blockchain.go forker in writeKnownBlock 1663-1672 Uses ForkChoice.ReorgNeeded() to decide reorg for known blocks core/forkchoice_pow.go
31 core/blockchain.go forker in writeBlockAndSetHead 1807-1815 Uses ForkChoice.ReorgNeeded() to decide reorg for new blocks core/forkchoice_pow.go
32 core/blockchain.go IsPow in NewBlockChain 428-429 Initializes ForkChoice with MESS for PoW chains core/forkchoice_pow.go
33 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
34 eth/downloader/fetchers_concurrent.go errNoPeers check 131 Returns errNoPeers when no peers available — triggers master peer cancel flow eth/downloader/downloader_pow.go
35 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
36 eth/downloader/fetchers.go cancelCh case 48 Listens on cancelCh to abort header fetching when master peer drops eth/downloader/downloader_pow.go

Function Calls

# File Name Lines Description Wires To
37 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
38 params/config.go CheckConfigForkOrder → checkConfigForkOrderETC 945 Validates ETC fork ordering (Gotham/DieHard/Etchash/Spiral interleaved with the shared forks) params/config_etc.go
39 core/rawdb/accessors_chain.go DeleteTd in DeleteBlock 737 Deletes TD when deleting a block (PoS doesn't have TD) core/rawdb/accessors_chain_pow.go
40 core/rawdb/accessors_chain.go DeleteTd in DeleteBlockWithoutNumber 746 Deletes TD in the variant without number lookup core/rawdb/accessors_chain_pow.go
41 core/blockchain.go WriteTd in SetHead reset 1221 Writes genesis TD during chain head reset core/rawdb/accessors_chain_pow.go
42 core/blockchain.go WriteTd for sidechain block 1645-1648 Calculates and writes TD for sidechain (non-canonical) blocks core/rawdb/accessors_chain_pow.go
43 core/blockchain.go WriteTd for canonical block 1693-1697 Calculates and writes TD for blocks inserted into the canonical chain core/rawdb/accessors_chain_pow.go
44 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
45 core/rawdb/chain_freezer.go AppendRaw TD in freezeRange 344-349 Appends TD to ancient freezer store during block freezing core/rawdb/ancient_scheme.go
46 core/genesis.go WriteTd in Commit 592 Writes genesis block total difficulty during chain database commit core/rawdb/accessors_chain_pow.go
47 ethstats/ethstats.go GetTd in assembleBlockStats 693,704 Fetches total difficulty for block stats reporting to ethstats server eth/api_backend_pow.go
48 internal/ethapi/backend.go GetTd in Backend interface 73 Interface method for fetching total difficulty by block hash — removed in PR #30386, restored for ETC eth/api_backend_pow.go
49 internal/ethapi/api.go rpcMarshalHeader in GetHeaderByNumber 467 Calls rpcMarshalHeader to inject totalDifficulty in header response internal/ethapi/api_pow.go
50 internal/ethapi/api.go rpcMarshalHeader in GetHeaderByHash 483 Calls rpcMarshalHeader to inject totalDifficulty in header response internal/ethapi/api_pow.go
51 internal/ethapi/api.go rpcMarshalBlock in GetBlockByNumber 498 Calls rpcMarshalBlock to inject totalDifficulty in block response internal/ethapi/api_pow.go
52 internal/ethapi/api.go rpcMarshalBlock in GetBlockByHash 518 Calls rpcMarshalBlock to inject totalDifficulty in block response internal/ethapi/api_pow.go
53 internal/ethapi/api.go rpcMarshalBlock in GetUncleByBlockNumberAndIndex 533 Calls rpcMarshalBlock to inject totalDifficulty in uncle response internal/ethapi/api_pow.go
54 internal/ethapi/api.go rpcMarshalBlock in GetUncleByBlockHashAndIndex 548 Calls rpcMarshalBlock to inject totalDifficulty in uncle response internal/ethapi/api_pow.go
55 eth/backend.go ResolvePath for ethash CacheDir 183 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.
56 eth/handler.go handler.minedBlockSub 142 PoW mined block subscription — subscribed in Start(), unsubscribed in Stop() eth/handler_mining_pow.go
57 eth/backend.go Conditional NewPoW miner creation 350-354 Creates miner with PoW support (miner.NewPoW) for IsPow chains, standard miner.New for PoS miner/miner_pow.go
58 eth/backend.go minerUpdate goroutine 352 Launches minerUpdate goroutine for PoW chains — coordinates mining pause/resume with downloader sync events eth/backend_mining_pow.go
59 eth/backend.go CloseMining in Stop 579 Closes PoW mining goroutines before stopping other subsystems miner/miner_pow.go

EIP-1559 Decoupling

# File Name Lines Description Wires To
60 core/chain_makers.go IsEIP1559 in GenerateChain header 240,242 Uses IsEIP1559 instead of IsLondon for base fee initialization in test chain generation
61 core/chain_makers.go IsEIP1559 in makeHeader 505,507 Uses IsEIP1559 instead of IsLondon for base fee calculation in test header construction
62 core/state_transition.go IsEIP1559 in gas price 341 Uses IsEIP1559 instead of IsLondon to determine effective gas price calculation
63 core/txpool/legacypool/legacypool.go IsEIP1559 in pool reset 1260 Uses IsEIP1559 instead of IsLondon for base fee tracking in transaction pool
64 eth/gasprice/feehistory.go IsEIP1559 in fee history 92 Uses IsEIP1559 instead of IsLondon for fee history base fee resolution
65 graphql/graphql.go IsEIP1559 in GraphQL baseFee 785 Uses IsEIP1559 instead of IsLondon for GraphQL base fee next-block estimation
66 internal/ethapi/simulate.go IsEIP1559 in simulation 213 Uses IsEIP1559 instead of IsLondon for base fee in block simulation
67 internal/ethapi/transaction_args.go IsEIP1559 in tx args 212 Uses IsEIP1559 instead of IsLondon for gas tip cap defaults in transaction arguments
68 miner/worker.go IsEIP1559 in miner 255,257 Uses IsEIP1559 instead of IsLondon for base fee initialization in block preparation

Constants & Variables

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

Added Functions

# File Name Lines Description Wires To
76 eth/ethconfig/config.go CreateConsensusEngineWithConfig 229-253 ETC consensus engine routing — creates ETCEngine/Ethash based on chain config consensus/etc
77 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
78 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
79 eth/downloader/downloader.go BlockChain.GetTd 188-189 GetTd method added to BlockChain interface — required for TD-based PoW sync core/blockchain_pow.go
80 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
81 ethstats/ethstats.go backend.GetTd 69 GetTd method added to ethstats backend interface — used for block stats reporting eth/api_backend_pow.go

Import Additions

# File Name Lines Description Wires To
82 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

Config Plumbing

# File Name Lines Description Wires To
83 eth/handler.go handlerConfig.IsPow 113 Config field that propagates IsPow flag from ethconfig to handler eth/backend.go
84 eth/handler.go isPow initialization 177-179 Copies config.IsPow into handler struct during construction
85 eth/backend.go IsPow passthrough 342 Passes IsPow from blockchain config to handler config eth/handler.go
86 eth/backend.go MESS flags passthrough 343-344 Passes MESSForceEnable/Disable from ethconfig to handler config eth/handler.go
87 eth/backend.go isPow to MakeProtocols 439 Passes isPow flag to eth.MakeProtocols for protocol version selection eth/protocols/eth/handler.go
88 eth/protocols/eth/handler.go MakeProtocols versions param 101 MakeProtocols accepts versions []uint param to select protocol versions for PoW eth/protocols/eth/protocol_pow.go
89 eth/protocols/eth/handler.go versionHandlers registry 169-171 Map[uint]map[uint64]msgHandler{} — runtime registry for version-specific message handlers (ETH68 PoW handlers registered via init()) eth/protocols/eth/handlers_pow.go
90 eth/protocols/eth/handler.go versionHandlers dispatch 203-204 Fallback dispatch in handleMessage — checks versionHandlers map for version-specific handlers (ETH68 PoW messages) eth/protocols/eth/handlers_pow.go