val set changes

This commit is contained in:
Ethan Buchman
2016-11-22 20:38:14 -05:00
parent d7f6c0775a
commit 655b6300f5
7 changed files with 77 additions and 20 deletions
+4 -4
View File
@@ -154,10 +154,10 @@ type Header struct {
Time time.Time `json:"time"`
NumTxs int `json:"num_txs"`
LastBlockID BlockID `json:"last_block_id"`
LastCommitHash []byte `json:"last_commit_hash"`
DataHash []byte `json:"data_hash"`
ValidatorsHash []byte `json:"validators_hash"`
AppHash []byte `json:"app_hash"` // state merkle root of txs from the previous block
LastCommitHash []byte `json:"last_commit_hash"` // commit from validators from the last block
ValidatorsHash []byte `json:"validators_hash"` // validators for the current block
DataHash []byte `json:"data_hash"` // transactions
AppHash []byte `json:"app_hash"` // state after txs from the previous block
}
// NOTE: hash is nil if required fields are missing.
+9
View File
@@ -20,6 +20,15 @@ type Validator struct {
Accum int64 `json:"accum"`
}
func NewValidator(pubKey crypto.PubKey, votingPower int64) *Validator {
return &Validator{
Address: pubKey.Address(),
PubKey: pubKey,
VotingPower: votingPower,
Accum: 0,
}
}
// Creates a new copy of the validator so we can mutate accum.
// Panics if the validator is nil.
func (v *Validator) Copy() *Validator {