func BlockHeaderFromProto(header *pb.BlockHeader) (*BlockHeader, error) {
	if len(header.RandaoReveal) > 48 {
		return nil, errors.New("randaoReveal should be 48 bytes long")
	}
	if len(header.Signature) > 48 {
		return nil, errors.New("signature should be 48 bytes long")
	}
	newHeader := &BlockHeader{
		SlotNumber:     header.SlotNumber,
		ValidatorIndex: header.ValidatorIndex,
	}

	copy(newHeader.RandaoReveal[:], header.RandaoReveal)
	copy(newHeader.Signature[:], header.Signature)

	err := newHeader.StateRoot.SetBytes(header.StateRoot)
	if err != nil {
		return nil, err
	}

	err = newHeader.ParentRoot.SetBytes(header.ParentRoot)
	if err != nil {
		return nil, err
	}

	return newHeader, nil
}
// BlockHeaderFromProto converts a protobuf representation of a block header to a block header.
BlockHeaderFromProto converts a protobuf representation of a block header to a block header.
// BlockHeaderFromProto converts a protobuf representation of a block header to a block header .
func BlockHeaderFromProto(header *pb.BlockHeader) (*BlockHeader, error) {
	if len(header.RandaoReveal) > 48 {
		return nil, errors.New("randaoReveal should be 48 bytes long")
	}
	if len(header.Signature) > 48 {
		return nil, errors.New("signature should be 48 bytes long")
	}
	newHeader := &BlockHeader{
		SlotNumber:     header.SlotNumber,
		ValidatorIndex: header.ValidatorIndex,
	}
	copy(newHeader.RandaoReveal[:], header.RandaoReveal)
	copy(newHeader.Signature[:], header.Signature)
	err := newHeader.StateRoot.SetBytes(header.StateRoot)
	if err != nil {
		return nil, err
	}
	err = newHeader.ParentRoot.SetBytes(header.ParentRoot)
	if err != nil {
		return nil, err
	}
	return newHeader, nil
}
func BlockHeaderFromProto ( header * pb . BlockHeader ) ( * BlockHeader , error ) { if len ( header . RandaoReveal ) > 48 { return nil , errors . New ( " " ) } if len ( header . Signature ) > 48 { return nil , errors . New ( " " ) } newHeader := & BlockHeader { SlotNumber : header . SlotNumber , ValidatorIndex : header . ValidatorIndex , } copy ( newHeader . RandaoReveal [ : ] , header . RandaoReveal ) copy ( newHeader . Signature [ : ] , header . Signature ) err := newHeader . StateRoot . SetBytes ( header . StateRoot ) if err != nil { return nil , err } err = newHeader . ParentRoot . SetBytes ( header . ParentRoot ) if err != nil { return nil , err } return newHeader , nil }
BlockHeaderFromProto converts a protobuf representation of a block header to a block header.
BlockHeaderFromProto converts a protobuf representation of a block header to a block header .