fixed GetLastProposalID function

This commit is contained in:
Sunny Aggarwal 2018-08-22 00:17:37 -07:00
parent 5ae20d2d51
commit 7f43d3b290
1 changed files with 2 additions and 4 deletions

View File

@ -167,12 +167,10 @@ func (keeper Keeper) setInitialProposalID(ctx sdk.Context, proposalID int64) sdk
// Get the last used proposal ID
func (keeper Keeper) GetLastProposalID(ctx sdk.Context) (proposalID int64) {
store := ctx.KVStore(keeper.storeKey)
bz := store.Get(KeyNextProposalID)
if bz == nil {
proposalID, err := keeper.peekCurrentProposalID(ctx)
if err != nil {
return 0
}
keeper.cdc.MustUnmarshalBinary(bz, &proposalID)
proposalID--
return
}