mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-23 11:57:18 +00:00
RPC: Use the proper db access level, use head root from head fetcher (#4752)
* Use the proper db access level, use head root from head fetcher * Reuse head root
This commit is contained in:
parent
8ad174ffd8
commit
9958afe79d
@ -85,15 +85,7 @@ func (vs *Server) GetAttestationData(ctx context.Context, req *ethpb.Attestation
|
||||
return nil, status.Errorf(codes.Internal, "Could not get target block for slot %d: %v", epochStartSlot, err)
|
||||
}
|
||||
if bytesutil.ToBytes32(targetRoot) == params.BeaconConfig().ZeroHash {
|
||||
b, err := vs.BeaconDB.HeadBlock(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not get head block: %v", err)
|
||||
}
|
||||
r, err := ssz.HashTreeRoot(b.Block)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not hash head block: %v", err)
|
||||
}
|
||||
targetRoot = r[:]
|
||||
targetRoot = headRoot
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ func init() {
|
||||
// and more.
|
||||
type Server struct {
|
||||
Ctx context.Context
|
||||
BeaconDB db.HeadAccessDatabase
|
||||
BeaconDB db.NoHeadAccessDatabase
|
||||
AttestationCache *cache.AttestationCache
|
||||
HeadFetcher blockchain.HeadFetcher
|
||||
ForkFetcher blockchain.ForkFetcher
|
||||
|
Loading…
Reference in New Issue
Block a user