prysm-pulse/shared/hashutil/beacon_block.go
Preston Van Loon 1f550a0da9
Handle nil protos (#1927)
* Handle hash nil pointers

* handle in hash beacon block

* add recovery when broadcasting p2p messages

* cmt

* gazelle
2019-03-07 11:32:01 -05:00

18 lines
530 B
Go

package hashutil
import (
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
)
// HashBeaconBlock hashes the full block without the proposer signature.
// The proposer signature is ignored in order obtain the same block hash used
// as the "block_root" property in the proposer signature data.
func HashBeaconBlock(bb *pb.BeaconBlock) ([32]byte, error) {
// Ignore the proposer signature by temporarily deleting it.
sig := bb.Signature
bb.Signature = nil
defer func() { bb.Signature = sig }()
return HashProto(bb)
}