mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
17a43c1158
* new stategen.StateReplayer/ReplayerBuilder to give more fine-grained control of replaying state+block history * all rpc/api methods updated to use the new interface, return post-state Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com> Co-authored-by: Radosław Kapka <rkapka@wp.pl> Co-authored-by: terence tsao <terence@prysmaticlabs.com>
29 lines
663 B
Go
29 lines
663 B
Go
package testutil
|
|
|
|
import (
|
|
"context"
|
|
|
|
types "github.com/prysmaticlabs/eth2-types"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/state"
|
|
)
|
|
|
|
// MockFetcher is a fake implementation of statefetcher.Fetcher.
|
|
type MockFetcher struct {
|
|
BeaconState state.BeaconState
|
|
BeaconStateRoot []byte
|
|
}
|
|
|
|
// State --
|
|
func (m *MockFetcher) State(context.Context, []byte) (state.BeaconState, error) {
|
|
return m.BeaconState, nil
|
|
}
|
|
|
|
// StateRoot --
|
|
func (m *MockFetcher) StateRoot(context.Context, []byte) ([]byte, error) {
|
|
return m.BeaconStateRoot, nil
|
|
}
|
|
|
|
func (m *MockFetcher) StateBySlot(context.Context, types.Slot) (state.BeaconState, error) {
|
|
return m.BeaconState, nil
|
|
}
|