func (s *ShardRPCServer) AnnounceProposal(ctx context.Context, req *pb.ProposalAnnouncement) (*empty.Empty, error) {
	blockHash, err := chainhash.NewHash(req.BlockHash)
	if err != nil {
		return nil, err
	}

	var mgr *chain.ShardManager

	if !s.sm.IsManaging(req.ShardID) {
		manager, err := s.sm.StartManaging(req.ShardID, chain.ShardChainInitializationParameters{
			RootBlockHash: *blockHash,
			RootSlot:      req.CrosslinkSlot,
		})
		if err != nil {
			return nil, err
		}

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

		mgr = manager
	}

	stateHash, err := chainhash.NewHash(req.StateHash)
	if err != nil {
		return nil, err
	}

	mgr.SyncManager.ProposalAnnounced(req.ProposalSlots, *stateHash, req.CrosslinkSlot)

	return &empty.Empty{}, nil
}
// AnnounceProposal instructs the shard module to subscribe to a specific shard and start downloading blocks. This is a
// no-op until we implement the P2P network.
AnnounceProposal instructs the shard module to subscribe to a specific shard and start downloading blocks. This is a
no-op until we implement the P2P network.
// AnnounceProposal instructs the shard module to subscribe to a specific shard and start downloading blocks . This is a // no - op until we implement the P2P network .
func (s *ShardRPCServer) AnnounceProposal(ctx context.Context, req *pb.ProposalAnnouncement) (*empty.Empty, error) {
	blockHash, err := chainhash.NewHash(req.BlockHash)
	if err != nil {
		return nil, err
	}
	var mgr *chain.ShardManager
	if !s.sm.IsManaging(req.ShardID) {
		manager, err := s.sm.StartManaging(req.ShardID, chain.ShardChainInitializationParameters{
			RootBlockHash: *blockHash,
			RootSlot:      req.CrosslinkSlot,
		})
		if err != nil {
			return nil, err
		}
		mgr = manager
	} else {
		manager, err := s.sm.GetManager(req.ShardID)
		if err != nil {
			return nil, err
		}
		mgr = manager
	}
	stateHash, err := chainhash.NewHash(req.StateHash)
	if err != nil {
		return nil, err
	}
	mgr.SyncManager.ProposalAnnounced(req.ProposalSlots, *stateHash, req.CrosslinkSlot)
	return &empty.Empty{}, nil
}
func ( s * ShardRPCServer ) AnnounceProposal ( ctx context . Context , req * pb . ProposalAnnouncement ) ( * empty . Empty , error ) { blockHash , err := chainhash . NewHash ( req . BlockHash ) if err != nil { return nil , err } var mgr * chain . ShardManager if ! s . sm . IsManaging ( req . ShardID ) { manager , err := s . sm . StartManaging ( req . ShardID , chain . ShardChainInitializationParameters { RootBlockHash : * blockHash , RootSlot : req . CrosslinkSlot , } ) if err != nil { return nil , err } mgr = manager } else { manager , err := s . sm . GetManager ( req . ShardID ) if err != nil { return nil , err } mgr = manager } stateHash , err := chainhash . NewHash ( req . StateHash ) if err != nil { return nil , err } mgr . SyncManager . ProposalAnnounced ( req . ProposalSlots , * stateHash , req . CrosslinkSlot ) return & empty . Empty { } , nil }
AnnounceProposal instructs the shard module to subscribe to a specific shard and start downloading blocks.
AnnounceProposal instructs the shard module to subscribe to a specific shard and start downloading blocks .