Commit e4ee5dc8 authored by Łukasz Magiera's avatar Łukasz Magiera

merkledag: keep key order in dedupeKeys

License: MIT
Signed-off-by: default avatarŁukasz Magiera <magik6k@gmail.com>
parent 0a5f16ec
......@@ -307,11 +307,14 @@ func GetNodes(ctx context.Context, ds DAGService, keys []*cid.Cid) []NodeGetter
// Remove duplicates from a list of keys
func dedupeKeys(cids []*cid.Cid) []*cid.Cid {
out := make([]*cid.Cid, 0, len(cids))
set := cid.NewSet()
for _, c := range cids {
set.Add(c)
if set.Visit(c) {
out = append(out, c)
}
}
return set.Keys()
return out
}
func newNodePromise(ctx context.Context) NodeGetter {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment