Skip to content

Commit

Permalink
Fixing genesis check
Browse files Browse the repository at this point in the history
  • Loading branch information
jleni committed Feb 5, 2019
1 parent f5ada58 commit d88ee17
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions x/gov/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func DefaultGenesisState() GenesisState {

// Checks whether 2 GenesisState structs are equivalent.
func (data GenesisState) Equal(data2 GenesisState) bool {
if data.StartingProposalID != data.StartingProposalID ||
if data.StartingProposalID != data2.StartingProposalID ||
!data.DepositParams.Equal(data2.DepositParams) ||
data.VotingParams != data2.VotingParams ||
data.TallyParams != data2.TallyParams {
Expand Down Expand Up @@ -97,7 +97,7 @@ func (data GenesisState) Equal(data2 GenesisState) bool {
return false
}
for i := range data.Proposals {
if data.Proposals[i] != data.Proposals[i] {
if data.Proposals[i] != data2.Proposals[i] {
return false
}
}
Expand Down
15 changes: 15 additions & 0 deletions x/gov/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ import (
abci "github.com/tendermint/tendermint/abci/types"
)

func TestEqualProposalID(t *testing.T) {
state1 := GenesisState{}
state2 := GenesisState{}
require.Equal(t, state1, state2)

// Proposals
state1.StartingProposalID = 1
require.NotEqual(t, state1, state2)
require.False(t, state1.Equal(state2))

state2.StartingProposalID = 1
require.Equal(t, state1, state2)
require.True(t, state1.Equal(state2))
}

func TestImportExportQueues(t *testing.T) {

// Generate mock app and keepers
Expand Down

0 comments on commit d88ee17

Please sign in to comment.