@@ -22,8 +22,8 @@ import (
22
22
"time"
23
23
24
24
"github.com/ethereum/go-ethereum/common"
25
- "github.com/ethereum/go-ethereum/core"
26
25
"github.com/ethereum/go-ethereum/core/state"
26
+ "github.com/ethereum/go-ethereum/core/state/snapshot"
27
27
"github.com/ethereum/go-ethereum/light"
28
28
"github.com/ethereum/go-ethereum/log"
29
29
"github.com/ethereum/go-ethereum/metrics"
@@ -61,11 +61,21 @@ const (
61
61
// exchanges have passed.
62
62
type Handler func (peer * Peer ) error
63
63
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
+
64
74
// Backend defines the data retrieval methods to serve remote requests and the
65
75
// callback methods to invoke on remote deliveries.
66
76
type Backend interface {
67
77
// Chain retrieves the blockchain object to serve data.
68
- Chain () * core. BlockChain
78
+ Chain () BlockChain
69
79
70
80
// RunPeer is invoked when a peer joins on the `eth` protocol. The handler
71
81
// should do any peer maintenance work, handshakes and validations. If all
@@ -523,6 +533,6 @@ func handleMessage(backend Backend, peer *Peer) error {
523
533
type NodeInfo struct {}
524
534
525
535
// nodeInfo retrieves some `snap` protocol metadata about the running host node.
526
- func nodeInfo (chain * core. BlockChain ) * NodeInfo {
536
+ func nodeInfo (BlockChain ) * NodeInfo {
527
537
return & NodeInfo {}
528
538
}
0 commit comments