github.com/MetalBlockchain/subnet-evm@v0.4.9/sync/handlers/test_providers.go (about)

     1  // (c) 2021-2022, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package handlers
     5  
     6  import (
     7  	"github.com/MetalBlockchain/subnet-evm/core/state/snapshot"
     8  	"github.com/MetalBlockchain/subnet-evm/core/types"
     9  	"github.com/ethereum/go-ethereum/common"
    10  )
    11  
    12  var (
    13  	_ BlockProvider    = &TestBlockProvider{}
    14  	_ SnapshotProvider = &TestSnapshotProvider{}
    15  )
    16  
    17  type TestBlockProvider struct {
    18  	GetBlockFn func(common.Hash, uint64) *types.Block
    19  }
    20  
    21  func (t *TestBlockProvider) GetBlock(hash common.Hash, number uint64) *types.Block {
    22  	return t.GetBlockFn(hash, number)
    23  }
    24  
    25  type TestSnapshotProvider struct {
    26  	Snapshot *snapshot.Tree
    27  }
    28  
    29  func (t *TestSnapshotProvider) Snapshots() *snapshot.Tree {
    30  	return t.Snapshot
    31  }