Exemple #1
0
        public async Task AnnounceIntermediateTrust(ulong epoch, uint iter, PeerToPeerTrust trust, CallOptions options = null, CancellationToken context = default)
        {
            var opts = DefaultCallOptions.ApplyCustomOptions(options);

            CheckOptions(opts);
            if (trust is null)
            {
                throw new ArgumentNullException(nameof(trust));
            }
            var req = new AnnounceIntermediateResultRequest
            {
                Body = new AnnounceIntermediateResultRequest.Types.Body
                {
                    Epoch     = epoch,
                    Iteration = iter,
                    Trust     = trust,
                }
            };

            req.MetaHeader = opts.GetRequestMetaHeader();
            opts.Key.Sign(req);
            var resp = await ReputationClient.AnnounceIntermediateResultAsync(req, cancellationToken : context);

            if (!resp.Verify())
            {
                throw new FormatException("invalid announce intermediate trust response");
            }
            CheckStatus(resp);
        }
Exemple #2
0
        public async Task AnnounceIntermediateTrust(AnnounceIntermediateResultRequest request, DateTime?deadline = null, CancellationToken context = default)
        {
            var resp = await ReputationClient.AnnounceIntermediateResultAsync(request, deadline : deadline, cancellationToken : context);

            if (!resp.Verify())
            {
                throw new FormatException("invalid announce intermediate trust response");
            }
            CheckStatus(resp);
        }