Example #1
0
        public async Task CrossChainIndexingShake()
        {
            var request = new IndexingHandShake
            {
                ListeningPort = 2100,
                ChainId       = 0
            };
            var context = BuildServerCallContext();
            var indexingHandShakeReply = await CrossChainGrpcServer.CrossChainIndexingShake(request, context);

            indexingHandShakeReply.ShouldNotBeNull();
            indexingHandShakeReply.Result.ShouldBeTrue();
        }
Example #2
0
        public override Task <IndexingHandShakeReply> CrossChainIndexingShake(IndexingHandShake request, ServerCallContext context)
        {
            var splitRes = context.Peer.Split(':');

            LocalEventBus.PublishAsync(new GrpcServeNewChainReceivedEvent
            {
                CrossChainCommunicationContextDto = new GrpcCrossChainCommunicationContext
                {
                    TargetIp          = splitRes[1],
                    TargetPort        = request.ListeningPort,
                    RemoteChainId     = request.ChainId,
                    RemoteIsSideChain = true,
                }
            });
            //Logger.LogWarning($"Hand shake from chain {request.ChainId}, ip {splitRes[1]}, port {request.ListeningPort}");
            return(Task.FromResult(new IndexingHandShakeReply {
                Result = true
            }));
        }