func (s *ShardRPCServer) GetBlockHashAtSlot(ctx context.Context, req *pb.SlotRequest) (*pb.BlockHashResponse, error) {
	if req.Slot == 0 {
		genesisBlock := primitives.GetGenesisBlockForShard(req.Shard)

		genesisHash, err := ssz.HashTreeRoot(genesisBlock)
		if err != nil {
			return nil, err
		}

		return &pb.BlockHashResponse{
			BlockHash: genesisHash[:],
			StateHash: primitives.EmptyTree[:],
		}, nil
	}

	manager, err := s.sm.GetManager(req.Shard)
	if err != nil {
		return nil, err
	}

	blockNode, err := manager.Chain.GetNodeBySlot(req.Slot)
	if err != nil {
		return nil, err
	}

	return &pb.BlockHashResponse{
		BlockHash: blockNode.BlockHash[:],
		StateHash: blockNode.StateRoot[:],
	}, nil
}
// GetBlockHashAtSlot gets the block hash at a specific slot on a specific shard.
GetBlockHashAtSlot gets the block hash at a specific slot on a specific shard.
// GetBlockHashAtSlot gets the block hash at a specific slot on a specific shard .
func (s *ShardRPCServer) GetBlockHashAtSlot(ctx context.Context, req *pb.SlotRequest) (*pb.BlockHashResponse, error) {
	if req.Slot == 0 {
		genesisBlock := primitives.GetGenesisBlockForShard(req.Shard)
		genesisHash, err := ssz.HashTreeRoot(genesisBlock)
		if err != nil {
			return nil, err
		}
		return &pb.BlockHashResponse{
			BlockHash: genesisHash[:],
			StateHash: primitives.EmptyTree[:],
		}, nil
	}
	manager, err := s.sm.GetManager(req.Shard)
	if err != nil {
		return nil, err
	}
	blockNode, err := manager.Chain.GetNodeBySlot(req.Slot)
	if err != nil {
		return nil, err
	}
	return &pb.BlockHashResponse{
		BlockHash: blockNode.BlockHash[:],
		StateHash: blockNode.StateRoot[:],
	}, nil
}
func ( s * ShardRPCServer ) GetBlockHashAtSlot ( ctx context . Context , req * pb . SlotRequest ) ( * pb . BlockHashResponse , error ) { if req . Slot == 0 { genesisBlock := primitives . GetGenesisBlockForShard ( req . Shard ) genesisHash , err := ssz . HashTreeRoot ( genesisBlock ) if err != nil { return nil , err } return & pb . BlockHashResponse { BlockHash : genesisHash [ : ] , StateHash : primitives . EmptyTree [ : ] , } , nil } manager , err := s . sm . GetManager ( req . Shard ) if err != nil { return nil , err } blockNode , err := manager . Chain . GetNodeBySlot ( req . Slot ) if err != nil { return nil , err } return & pb . BlockHashResponse { BlockHash : blockNode . BlockHash [ : ] , StateHash : blockNode . StateRoot [ : ] , } , nil }
GetBlockHashAtSlot gets the block hash at a specific slot on a specific shard.
GetBlockHashAtSlot gets the block hash at a specific slot on a specific shard .