2023-10-10 15:12:20 +00:00
|
|
|
package testing
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2024-02-03 11:57:01 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v4/api/server/structs"
|
2023-10-10 15:12:20 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state"
|
|
|
|
"github.com/prysmaticlabs/prysm/v4/consensus-types/interfaces"
|
2023-12-08 20:37:20 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v4/network/httputil"
|
2023-10-10 15:12:20 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type MockBlockRewardFetcher struct {
|
2024-02-03 11:57:01 +00:00
|
|
|
Rewards *structs.BlockRewards
|
2023-12-15 03:26:48 +00:00
|
|
|
Error *httputil.DefaultJsonError
|
2023-10-10 15:12:20 +00:00
|
|
|
State state.BeaconState
|
|
|
|
}
|
|
|
|
|
2024-02-03 11:57:01 +00:00
|
|
|
func (m *MockBlockRewardFetcher) GetBlockRewardsData(_ context.Context, _ interfaces.ReadOnlyBeaconBlock) (*structs.BlockRewards, *httputil.DefaultJsonError) {
|
2023-10-10 15:12:20 +00:00
|
|
|
if m.Error != nil {
|
|
|
|
return nil, m.Error
|
|
|
|
}
|
|
|
|
return m.Rewards, nil
|
|
|
|
}
|
|
|
|
|
2023-12-15 03:26:48 +00:00
|
|
|
func (m *MockBlockRewardFetcher) GetStateForRewards(_ context.Context, _ interfaces.ReadOnlyBeaconBlock) (state.BeaconState, *httputil.DefaultJsonError) {
|
2023-10-10 15:12:20 +00:00
|
|
|
if m.Error != nil {
|
|
|
|
return nil, m.Error
|
|
|
|
}
|
|
|
|
return m.State, nil
|
|
|
|
}
|