Example #1
0
        public Task <BlockchainProof> Handle(AddNewBlockchainProofCommand request, CancellationToken cancellationToken)
        {
            var proof = new BlockchainProof();

            _db.Proofs.Add(proof);
            _db.SaveChanges();

            _mediator.Publish(new BlockchainProofCreatedNotification(proof));

            return(Task.FromResult(proof));
        }
        public override void Execute()
        {
            var proofs = _db.Proofs
                         .Where(p => p.Status == ProofStatusType.Waiting.ToString())
                         .Select(p => p);

            foreach (var proof in proofs)
            {
                ProcessProof(proof);
            }
            _db.SaveChanges();

            Wait(_configuration.ConfirmationWait(_configuration.Blockchain()));
        }