github.com/prysmaticlabs/prysm@v1.4.4/beacon-chain/rpc/testutil/mock_state_fetcher.go (about)

     1  package testutil
     2  
     3  import (
     4  	"context"
     5  
     6  	iface "github.com/prysmaticlabs/prysm/beacon-chain/state/interface"
     7  )
     8  
     9  // MockFetcher is a fake implementation of statefetcher.Fetcher.
    10  type MockFetcher struct {
    11  	BeaconState     iface.BeaconState
    12  	BeaconStateRoot []byte
    13  }
    14  
    15  // State --
    16  func (m *MockFetcher) State(context.Context, []byte) (iface.BeaconState, error) {
    17  	return m.BeaconState, nil
    18  }
    19  
    20  // StateRoot --
    21  func (m *MockFetcher) StateRoot(context.Context, []byte) ([]byte, error) {
    22  	return m.BeaconStateRoot, nil
    23  }