...
This commit is contained in:
parent
b34988332f
commit
18fc7aec73
|
@ -408,17 +408,12 @@ func (cs *ConsensusState) stageBlock(block *Block) error {
|
||||||
return nil
|
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
|
// 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.
|
// 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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -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…
Reference in New Issue