mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-21 07:24:36 +00:00
draft of consensus+state code, compiles.
This commit is contained in:
+4
-16
@@ -4,9 +4,7 @@ import (
|
||||
"io"
|
||||
|
||||
. "github.com/tendermint/tendermint/binary"
|
||||
. "github.com/tendermint/tendermint/blocks"
|
||||
. "github.com/tendermint/tendermint/common"
|
||||
db_ "github.com/tendermint/tendermint/db"
|
||||
)
|
||||
|
||||
// Holds state for a Validator at a given height+round.
|
||||
@@ -54,20 +52,6 @@ func (v *Validator) WriteTo(w io.Writer) (n int64, err error) {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// TODO: Ensure that double signing never happens via an external persistent check.
|
||||
type PrivValidator struct {
|
||||
PrivAccount
|
||||
db *db_.LevelDB
|
||||
}
|
||||
|
||||
// Modifies the vote object in memory.
|
||||
// Double signing results in an error.
|
||||
func (pv *PrivValidator) SignVote(vote *Vote) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Not goroutine-safe.
|
||||
type ValidatorSet struct {
|
||||
validators map[uint64]*Validator
|
||||
@@ -124,6 +108,10 @@ func (v *ValidatorSet) Map() map[uint64]*Validator {
|
||||
return v.validators
|
||||
}
|
||||
|
||||
func (v *ValidatorSet) Size() int {
|
||||
return len(v.validators)
|
||||
}
|
||||
|
||||
// TODO: cache proposer. invalidate upon increment.
|
||||
func (v *ValidatorSet) GetProposer() (proposer *Validator) {
|
||||
highestAccum := int64(0)
|
||||
|
||||
Reference in New Issue
Block a user