beacon/types: rename Hash() -> Root()

This commit is contained in:
Felix Lange 2024-03-13 20:20:25 +01:00
parent da73defa70
commit 91e60d8d56
3 changed files with 4 additions and 4 deletions

View file

@ -107,7 +107,7 @@ func blockHeadInfo(block *types.BeaconBlock) types.HeadInfo {
if block == nil { if block == nil {
return types.HeadInfo{} return types.HeadInfo{}
} }
return types.HeadInfo{Slot: block.Slot(), BlockRoot: block.Hash()} return types.HeadInfo{Slot: block.Slot(), BlockRoot: block.Root()}
} }
func (s *beaconBlockSync) updateEventFeed() { func (s *beaconBlockSync) updateEventFeed() {

View file

@ -376,7 +376,7 @@ func (api *BeaconLightApi) GetBeaconBlock(blockRoot common.Hash) (*types.BeaconB
if err != nil { if err != nil {
return nil, err return nil, err
} }
computedRoot := block.Hash() computedRoot := block.Root()
if computedRoot != blockRoot { if computedRoot != blockRoot {
return nil, fmt.Errorf("Beacon block root hash mismatch (expected: %x, got: %x)", blockRoot, computedRoot) return nil, fmt.Errorf("Beacon block root hash mismatch (expected: %x, got: %x)", blockRoot, computedRoot)
} }

View file

@ -104,7 +104,7 @@ func (b *BeaconBlock) Header() Header {
} }
} }
// Hash computes the hash of the block. // Root computes the SSZ root hash of the block.
func (b *BeaconBlock) Hash() common.Hash { func (b *BeaconBlock) Root() common.Hash {
return common.Hash(b.blockObj.HashTreeRoot(configs.Mainnet, tree.GetHashFn())) return common.Hash(b.blockObj.HashTreeRoot(configs.Mainnet, tree.GetHashFn()))
} }