From 18fc7aec7336a28ab9b03681f07ffe8197f90449 Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Tue, 14 Oct 2014 13:11:54 -0700 Subject: [PATCH] ... --- consensus/state.go | 11 +++-------- consensus/vote_set_test.go | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 consensus/vote_set_test.go diff --git a/consensus/state.go b/consensus/state.go index 8eda7cb48..a590b9213 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -408,17 +408,12 @@ func (cs *ConsensusState) stageBlock(block *Block) error { return nil } - // Basic validation is done in state.CommitBlock(). - //err := block.ValidateBasic() - //if err != nil { - // return err - //} - // Create a copy of the state for staging - stateCopy := cs.state.Copy() // Deep copy the state before staging. + stateCopy := cs.state.Copy() // Commit block onto the copied state. - err := stateCopy.AppendBlock(block) + // NOTE: Basic validation is done in state.AppendBlock(). + err := stateCopy.AppendBlock(block, true) if err != nil { return err } else { diff --git a/consensus/vote_set_test.go b/consensus/vote_set_test.go new file mode 100644 index 000000000..3d378138f --- /dev/null +++ b/consensus/vote_set_test.go @@ -0,0 +1,24 @@ +package consensus + +import ( + . "github.com/tendermint/tendermint/state" + + "testing" +) + +func makeValidator(id uint64, votingPower uint64) (*Validator, *PrivAccount) { + privAccount := GenPrivAccount() + privAccount.Id = id + return &Validator{ + Account: privAccount.Account, + VotingPower: votingPower, + }, privAccount +} + +func TestAddVote(t *testing.T) { + // XXX +} + +func Test2_3Majority(t *testing.T) { + // XXX +}