When not saving incomplete tilevars, still save hashes/indexes.
[lightning.git] / annotate.go
index 7787ae231838430840d6ae4ef5631ac08750f9b6..34d1c97af586acc4f2def992b261e03f7d0d0b5b 100644 (file)
@@ -109,7 +109,7 @@ func (cmd *annotatecmd) RunCommand(prog string, args []string, stdin io.Reader,
        bufw := bufio.NewWriter(output)
 
        tilelib := &tileLibrary{
-               includeNoCalls:      true,
+               retainNoCalls:       true,
                retainTileSequences: true,
        }
        err = tilelib.LoadGob(context.Background(), input, nil)
@@ -232,7 +232,9 @@ func (cmd *annotatecmd) annotateSequence(throttle *throttle, outch chan<- string
                for variant := 1; variant <= len(tvs); variant++ {
                        variant, hash := tileVariantID(variant), tvs[variant-1]
                        tileseq := tilelib.TileVariantSequence(tileLibRef{Tag: tag, Variant: variant})
-                       if len(tileseq) < taglen {
+                       if len(tileseq) == 0 {
+                               continue
+                       } else if len(tileseq) < taglen {
                                return fmt.Errorf("tilevar %d,%d has sequence len %d < taglen %d", tag, variant, len(tileseq), taglen)
                        }
                        var refpart []byte