Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove dead code in cacheMergeIterator Domain() #13433

Merged
merged 11 commits into from Oct 5, 2022
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -77,6 +77,9 @@ Ref: https://keepachangelog.com/en/1.0.0/
* [#13168](https://github.com/cosmos/cosmos-sdk/pull/13168) Migrate tendermintdev/proto-builder to ghcr.io. New image `ghcr.io/cosmos/proto-builder:0.8`
* [#13178](https://github.com/cosmos/cosmos-sdk/pull/13178) Add `cosmos.msg.v1.service` protobuf annotation to allow tooling to distinguish between Msg and Query services via reflection.
* [#13236](https://github.com/cosmos/cosmos-sdk/pull/13236) Integrate Filter Logging
* [#13301](https://github.com/cosmos/cosmos-sdk/pull/13301) Keep the balance query endpoint compatible with legacy blocks
* [#13321](https://github.com/cosmos/cosmos-sdk/pull/13321) Add flag to disable fast node migration and usage.
facundomedica marked this conversation as resolved.
Show resolved Hide resolved
* [#13433](https://github.com/cosmos/cosmos-sdk/pull/13433) Remove dead code in cacheMergeIterator `Domain()`.

### State Machine Breaking

Expand Down
11 changes: 6 additions & 5 deletions store/cachekv/memiterator.go
Expand Up @@ -19,8 +19,10 @@ type memIterator struct {
}

func newMemIterator(start, end []byte, items *dbm.MemDB, deleted map[string]struct{}, ascending bool) *memIterator {
var iter types.Iterator
var err error
var (
iter types.Iterator
err error
)

if ascending {
iter, err = items.Iterator(start, end)
Expand All @@ -34,9 +36,8 @@ func newMemIterator(start, end []byte, items *dbm.MemDB, deleted map[string]stru

return &memIterator{
Iterator: iter,

lastKey: nil,
deleted: deleted,
lastKey: nil,
deleted: deleted,
}
}

Expand Down
18 changes: 1 addition & 17 deletions store/cachekv/mergeiterator.go
Expand Up @@ -33,24 +33,8 @@ func newCacheMergeIterator(parent, cache types.Iterator, ascending bool) *cacheM
}

// Domain implements Iterator.
julienrbrt marked this conversation as resolved.
Show resolved Hide resolved
// If the domains are different, returns the union.
func (iter *cacheMergeIterator) Domain() (start, end []byte) {
startP, endP := iter.parent.Domain()
startC, endC := iter.cache.Domain()

if iter.compare(startP, startC) < 0 {
start = startP
} else {
start = startC
}

if iter.compare(endP, endC) < 0 {
end = endC
} else {
end = endP
}

return start, end
return iter.parent.Domain()
}

// Valid implements Iterator.
Expand Down