public Vote(Protocol.Vote protoVote) { this.VoterId = protoVote.VoterId; this.Ballot = protoVote.Ballot; this.Signature = protoVote.Signature; this.Hash = this.ComputeHash(); }
public Protocol.Vote Build(Vote vote) { var protoVote = new Protocol.Vote { VersionNumber = 1, VoterId = vote.VoterId, Ballot = vote.Ballot, Signature = vote.Signature }; return(protoVote); }
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())); }