Remove custom block body root and block root methods (#8069)

* Remove custom block body root and block root methods

* Add nil checks and fix tests

* Fmt

* Typo
This commit is contained in:
terence tsao
2020-12-09 10:11:42 -08:00
committed by GitHub
parent 92736d0188
commit 00dacbd00d
10 changed files with 11 additions and 201 deletions

View File

@@ -6,7 +6,6 @@ go_library(
importpath = "github.com/prysmaticlabs/prysm/proto/migration",
visibility = ["//visibility:public"],
deps = [
"//beacon-chain/state/stateutil:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_pkg_errors//:go_default_library",
"@com_github_prysmaticlabs_ethereumapis//eth/v1:go_default_library",

View File

@@ -5,12 +5,11 @@ import (
"github.com/pkg/errors"
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1"
ethpb_alpha "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
"github.com/prysmaticlabs/prysm/beacon-chain/state/stateutil"
)
// V1Alpha1BlockToV1BlockHeader converts a v1alpha1 SignedBeaconBlock proto to a v1 SignedBeaconBlockHeader proto.
func V1Alpha1BlockToV1BlockHeader(block *ethpb_alpha.SignedBeaconBlock) (*ethpb.SignedBeaconBlockHeader, error) {
bodyRoot, err := stateutil.BlockBodyRoot(block.Block.Body)
bodyRoot, err := block.Block.Body.HashTreeRoot()
if err != nil {
return nil, errors.Wrap(err, "failed to get body root of block")
}