This repository was archived by the owner on Jan 20, 2026. It is now read-only.
Open
Conversation
Comment on lines
+438
to
+442
| for k, v := range balances { | ||
| dst := make([]types.Coin, len(v)) | ||
| copy(dst, v) | ||
| bal[k] = dst | ||
| } |
Check warning
Code scanning / CodeQL
Iteration over map Warning
Comment on lines
+48
to
+95
| go func() { | ||
| if useMtx { | ||
| defer db.mtx.RUnlock() | ||
| } | ||
| // Because we use [start, end) for reverse ranges, while btree uses (start, end], we need | ||
| // the following variables to handle some reverse iteration conditions ourselves. | ||
| var ( | ||
| skipEqual []byte | ||
| abortLessThan []byte | ||
| ) | ||
| visitor := func(i btree.Item) bool { | ||
| item := i.(*item) | ||
| if skipEqual != nil && bytes.Equal(item.key, skipEqual) { | ||
| skipEqual = nil | ||
| return true | ||
| } | ||
| if abortLessThan != nil && bytes.Compare(item.key, abortLessThan) == -1 { | ||
| return false | ||
| } | ||
| select { | ||
| case <-ctx.Done(): | ||
| return false | ||
| case ch <- item: | ||
| return true | ||
| } | ||
| } | ||
| switch { | ||
| case start == nil && end == nil && !reverse: | ||
| db.btree.Ascend(visitor) | ||
| case start == nil && end == nil && reverse: | ||
| db.btree.Descend(visitor) | ||
| case end == nil && !reverse: | ||
| // must handle this specially, since nil is considered less than anything else | ||
| db.btree.AscendGreaterOrEqual(newKey(start), visitor) | ||
| case !reverse: | ||
| db.btree.AscendRange(newKey(start), newKey(end), visitor) | ||
| case end == nil: | ||
| // abort after start, since we use [start, end) while btree uses (start, end] | ||
| abortLessThan = start | ||
| db.btree.Descend(visitor) | ||
| default: | ||
| // skip end and abort after start, since we use [start, end) while btree uses (start, end] | ||
| skipEqual = end | ||
| abortLessThan = start | ||
| db.btree.DescendLessOrEqual(newKey(end), visitor) | ||
| } | ||
| close(ch) | ||
| }() |
Check notice
Code scanning / CodeQL
Spawning a Go routine Note test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.