@@ -22,8 +22,8 @@ import (
2222 "time"
2323
2424 "github.com/ethereum/go-ethereum/common"
25- "github.com/ethereum/go-ethereum/core"
2625 "github.com/ethereum/go-ethereum/core/state"
26+ "github.com/ethereum/go-ethereum/core/state/snapshot"
2727 "github.com/ethereum/go-ethereum/light"
2828 "github.com/ethereum/go-ethereum/log"
2929 "github.com/ethereum/go-ethereum/metrics"
@@ -61,11 +61,21 @@ const (
6161// exchanges have passed.
6262type Handler func (peer * Peer ) error
6363
64+ type BlockChain interface {
65+ // StateCache returns the caching database underpinning the blockchain instance.
66+ StateCache () state.Database
67+ // ContractCode retrieves a blob of data associated with a contract hash
68+ // either from ephemeral in-memory cache, or from persistent storage.
69+ ContractCode (hash common.Hash ) ([]byte , error )
70+ // Snapshots returns the blockchain snapshot tree.
71+ Snapshots () * snapshot.Tree
72+ }
73+
6474// Backend defines the data retrieval methods to serve remote requests and the
6575// callback methods to invoke on remote deliveries.
6676type Backend interface {
6777 // Chain retrieves the blockchain object to serve data.
68- Chain () * core. BlockChain
78+ Chain () BlockChain
6979
7080 // RunPeer is invoked when a peer joins on the `eth` protocol. The handler
7181 // should do any peer maintenance work, handshakes and validations. If all
@@ -523,6 +533,6 @@ func handleMessage(backend Backend, peer *Peer) error {
523533type NodeInfo struct {}
524534
525535// nodeInfo retrieves some `snap` protocol metadata about the running host node.
526- func nodeInfo (chain * core. BlockChain ) * NodeInfo {
536+ func nodeInfo (BlockChain ) * NodeInfo {
527537 return & NodeInfo {}
528538}
0 commit comments