func (s *server) SubmitBlock(ctx context.Context, in *pb.SubmitBlockRequest) (*pb.SubmitBlockResponse, error) {
	b, err := primitives.BlockFromProto(in.Block)
	if err != nil {
		return nil, err
	}

	_, _, err = s.chain.ProcessBlock(b, true, true)
	if err != nil {
		return nil, err
	}
	h, err := ssz.HashTreeRoot(b)
	if err != nil {
		return nil, err
	}

	data, err := proto.Marshal(b.ToProto())
	if err != nil {
		return nil, err
	}

	err = s.p2p.Broadcast("block", data)
	if err != nil {
		return nil, err
	}
	return &pb.SubmitBlockResponse{BlockHash: h[:]}, err
}
// SubmitBlock submits a block to the network after verifying it
SubmitBlock submits a block to the network after verifying it
// SubmitBlock submits a block to the network after verifying it
func (s *server) SubmitBlock(ctx context.Context, in *pb.SubmitBlockRequest) (*pb.SubmitBlockResponse, error) {
	b, err := primitives.BlockFromProto(in.Block)
	if err != nil {
		return nil, err
	}
	_, _, err = s.chain.ProcessBlock(b, true, true)
	if err != nil {
		return nil, err
	}
	h, err := ssz.HashTreeRoot(b)
	if err != nil {
		return nil, err
	}
	data, err := proto.Marshal(b.ToProto())
	if err != nil {
		return nil, err
	}
	err = s.p2p.Broadcast("block", data)
	if err != nil {
		return nil, err
	}
	return &pb.SubmitBlockResponse{BlockHash: h[:]}, err
}
func ( s * server ) SubmitBlock ( ctx context . Context , in * pb . SubmitBlockRequest ) ( * pb . SubmitBlockResponse , error ) { b , err := primitives . BlockFromProto ( in . Block ) if err != nil { return nil , err } _ , _ , err = s . chain . ProcessBlock ( b , true , true ) if err != nil { return nil , err } h , err := ssz . HashTreeRoot ( b ) if err != nil { return nil , err } data , err := proto . Marshal ( b . ToProto ( ) ) if err != nil { return nil , err } err = s . p2p . Broadcast ( " " , data ) if err != nil { return nil , err } return & pb . SubmitBlockResponse { BlockHash : h [ : ] } , err }
SubmitBlock submits a block to the network after verifying it
SubmitBlock submits a block to the network after verifying it