results

package
v1.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxQuestions is the maximum number of questions allowed in a VotePackage
	MaxQuestions = 64
	// MaxOptions is the maximum number of options allowed in a VotePackage question
	MaxOptions = 768
)

Variables

This section is empty.

Functions

func NewEmptyVotes

func NewEmptyVotes(questions, options int) [][]*types.BigInt

NewEmptyVotes creates a new results struct with the given number of questions and options

Types

type Results

type Results struct {
	ProcessID      types.HexBytes             `json:"processId"`
	Votes          [][]*types.BigInt          `json:"votes"`
	Weight         *types.BigInt              `json:"weight"`
	EnvelopeHeight uint64                     `json:"envelopeHeight"`
	EnvelopeType   *models.EnvelopeType       `json:"envelopeType"`
	VoteOpts       *models.ProcessVoteOptions `json:"voteOptions"`
	Signatures     []types.HexBytes           `json:"signatures"`
	Final          bool                       `json:"final"`
	BlockHeight    uint32                     `json:"blockHeight"`
}

Results holds the final results and relevant process info for a vochain process

func (*Results) Add

func (r *Results) Add(new *Results) error

Add adds the total weight and votes from the given Results to the containing Results making the method call.

func (*Results) AddVote

func (r *Results) AddVote(voteValues []int, weight *big.Int, mutex *sync.Mutex) error

AddVote adds the voteValues and weight to the Results struct. Checks are performed according the Ballot Protocol.

func (*Results) String

func (r *Results) String() string

String formats the results in a human-readable string

func (*Results) Sub

func (r *Results) Sub(new *Results) error

Sub subtracts the total weight and votes from the given Results to the containing Results.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL