Skip to content

Commit ecc4261

Browse files
authored
fix: skip traversal of links with the same cid (filecoin-project#76)
* fix: skip traversal of links with the same cid * fix non-parallel version
1 parent fab6283 commit ecc4261

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

diff.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,9 @@ func diffNode(ctx context.Context, prevCtx, curCtx *nodeContext, prev, cur *node
263263
}
264264

265265
// Both previous and current have links to diff
266+
if prev.links[i].cid == cur.links[i].cid {
267+
continue
268+
}
266269

267270
prevSubCtx := &nodeContext{
268271
bs: prevCtx.bs,

diff_parallel.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,9 @@ func (s *diffScheduler) work(ctx context.Context, todo *task, results chan *Chan
414414
}
415415

416416
// Both previous and current have links to diff
417+
if prev.links[i].cid == cur.links[i].cid {
418+
continue
419+
}
417420

418421
prevSubCtx := &nodeContext{
419422
bs: prevCtx.bs,

0 commit comments

Comments
 (0)