mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-09 11:11:20 +00:00
af70677778
* adding in block rewards to represent consensus payload * Update beacon-chain/rpc/eth/validator/handlers_block.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * radek's comments * more review changes * adding more tests for forks * gaz * updating names * gaz * fixing imports * fixing variable name * gaz * fixing test * renaming variables to match data --------- Co-authored-by: Radosław Kapka <rkapka@wp.pl>
31 lines
876 B
Go
31 lines
876 B
Go
package testing
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/rewards"
|
|
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state"
|
|
"github.com/prysmaticlabs/prysm/v4/consensus-types/interfaces"
|
|
http2 "github.com/prysmaticlabs/prysm/v4/network/http"
|
|
)
|
|
|
|
type MockBlockRewardFetcher struct {
|
|
Rewards *rewards.BlockRewards
|
|
Error *http2.DefaultErrorJson
|
|
State state.BeaconState
|
|
}
|
|
|
|
func (m *MockBlockRewardFetcher) GetBlockRewardsData(_ context.Context, _ interfaces.ReadOnlySignedBeaconBlock) (*rewards.BlockRewards, *http2.DefaultErrorJson) {
|
|
if m.Error != nil {
|
|
return nil, m.Error
|
|
}
|
|
return m.Rewards, nil
|
|
}
|
|
|
|
func (m *MockBlockRewardFetcher) GetStateForRewards(_ context.Context, _ interfaces.ReadOnlySignedBeaconBlock) (state.BeaconState, *http2.DefaultErrorJson) {
|
|
if m.Error != nil {
|
|
return nil, m.Error
|
|
}
|
|
return m.State, nil
|
|
}
|