@@ -21,7 +21,6 @@ import (
2121)
2222
2323func ValidateProof (ctx context.Context , root cid.Cid , offset uint64 , proof []byte ) (bool , error ) {
24- fmt .Printf ("Validating %s\n " , root )
2524 r := bufio .NewReader (bytes .NewReader (proof ))
2625
2726 bstore := blockstore .NewBlockstore (dssync .MutexWrap (datastore .NewMapDatastore ()))
@@ -66,7 +65,6 @@ func CreateProof(ctx context.Context, root cid.Cid, offset uint64, dserv ipld.DA
6665
6766 var currOffset , layer uint64
6867 for n != nil {
69- fmt .Printf ("In layer %d, numLinks=%d\n " , layer , len (n .Links ()))
7068 var next ipld.Node
7169 for _ , child := range n .Links () {
7270 cn , err := child .GetNode (ctx , dserv )
@@ -75,14 +73,14 @@ func CreateProof(ctx context.Context, root cid.Cid, offset uint64, dserv ipld.DA
7573 }
7674 list = append (list , cn )
7775
78- fmt .Printf ("\t %s currOffset=%d\n " , child .Cid , currOffset )
7976 if next == nil {
8077 fsNode , err := unixfs .ExtractFSNode (n )
8178 if err != nil {
8279 return nil , fmt .Errorf ("extracting fsnode from merkle-dag: %s" , err )
8380 }
8481 if currOffset + fsNode .FileSize () >= offset {
8582 next = cn
83+ break
8684 } else {
8785 currOffset += fsNode .FileSize ()
8886 }
0 commit comments