diff --git a/x/gov/genesis.go b/x/gov/genesis.go index 9c44b2f007fa..0ff41bb4c09c 100644 --- a/x/gov/genesis.go +++ b/x/gov/genesis.go @@ -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 { @@ -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 } } diff --git a/x/gov/genesis_test.go b/x/gov/genesis_test.go index 87d466b5f179..69ab53c99ac2 100644 --- a/x/gov/genesis_test.go +++ b/x/gov/genesis_test.go @@ -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