예제 #1
0
        // POST api/<controller>
        public void Post([FromBody] Votes.Vote request)
        {
            var foundUser = Utils.FindAccountByType("(samAccountName={0})", request.CreatedBy);

            if (foundUser != null)
            {
                request.CreatedByName = foundUser.Properties["displayName"][0].ToString();
            }

            Votes.Save(request);
        }
예제 #2
0
        public override Task <Empty> BroadcastVote(Protocol.Vote protoVote, ServerCallContext context)
        {
            var vote = new Votes.Vote(protoVote);

            if (!this.voteValidator.IsValid(vote))
            {
                return(Task.FromResult(new Empty()));
            }

            this.voteMemoryPool.AddVote(vote);

            // want to fill up blocks with as many votes as possible, so we
            // ask miner to start over if a new txn comes in and can fit it in block
            if (this.voteMemoryPool.Count <= Block.MaxVotes)
            {
                this.miner.AbandonCurrentBlock();
            }

            return(Task.FromResult(new Empty()));
        }