Browse Source

...

pull/9/head
Jae Kwon 10 years ago
parent
commit
18fc7aec73
2 changed files with 27 additions and 8 deletions
  1. +3
    -8
      consensus/state.go
  2. +24
    -0
      consensus/vote_set_test.go

+ 3
- 8
consensus/state.go View File

@ -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 {


+ 24
- 0
consensus/vote_set_test.go View File

@ -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
}

Loading…
Cancel
Save