Skip to content

Commit 96a03d4

Browse files
fix: skip content size validation when DAG has missing content
1 parent dbd9569 commit 96a03d4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

dag/leaves.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,18 @@ func (leaf *DagLeaf) VerifyRootLeaf(dag *Dag) error {
451451
}
452452
}
453453

454-
if isFullDag {
454+
// If any leaf has a content hash but the content field is empty, we can't verify size
455+
hasContentMissing := false
456+
if isFullDag && dag != nil {
457+
for _, l := range dag.Leafs {
458+
if len(l.ContentHash) > 0 && l.Content == nil {
459+
hasContentMissing = true
460+
break
461+
}
462+
}
463+
}
464+
465+
if isFullDag && !hasContentMissing {
455466
for _, dagLeaf := range dag.Leafs {
456467
if dagLeaf.Content != nil {
457468
calculatedContentSize += int64(len(dagLeaf.Content))

0 commit comments

Comments
 (0)