diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dac7ee8b..091425cb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased + +- [\#318](https://github.com/cosmos/iavl/pull/318) Fix constant overflow when compiling for 32bit machines. + ## 0.14.1 (October 9, 2020) ### Improvements diff --git a/nodedb.go b/nodedb.go index 2ec7806fe..04f8d91e0 100644 --- a/nodedb.go +++ b/nodedb.go @@ -230,7 +230,7 @@ func (ndb *nodeDB) DeleteVersionsFrom(version int64) error { }) // Finally, delete the version root entries - ndb.traverseRange(rootKeyFormat.Key(version), rootKeyFormat.Key(math.MaxInt64), func(k, v []byte) { + ndb.traverseRange(rootKeyFormat.Key(version), rootKeyFormat.Key(int64(math.MaxInt64)), func(k, v []byte) { ndb.batch.Delete(k) }) diff --git a/repair.go b/repair.go index 157eb1fc3..325fae94d 100644 --- a/repair.go +++ b/repair.go @@ -41,7 +41,7 @@ func Repair013Orphans(db dbm.DB) (uint64, error) { ) batch := db.NewBatch() defer batch.Close() - ndb.traverseRange(orphanKeyFormat.Key(version), orphanKeyFormat.Key(math.MaxInt64), func(k, v []byte) { + ndb.traverseRange(orphanKeyFormat.Key(version), orphanKeyFormat.Key(int64(math.MaxInt64)), func(k, v []byte) { // Sanity check so we don't remove stuff we shouldn't var toVersion int64 orphanKeyFormat.Scan(k, &toVersion)