From 7eb98d5700682612ee989460a4a25cf33dafde87 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 14 Jun 2018 20:44:12 -0700 Subject: [PATCH] gcs/builder: skip zero nil outputs scripts --- gcs/builder/builder.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcs/builder/builder.go b/gcs/builder/builder.go index 5712df8..b2c945a 100644 --- a/gcs/builder/builder.go +++ b/gcs/builder/builder.go @@ -331,6 +331,10 @@ func BuildBasicFilter(block *wire.MsgBlock, prevOutScripts [][]byte) (*gcs.Filte // For each output in a transaction, we'll add each of the // individual data pushes within the script. for _, txOut := range tx.TxOut { + if len(txOut.PkScript) == 0 { + continue + } + // In order to allow the filters to later be committed // to within an OP_RETURN output, we ignore all // OP_RETURNs to avoid a circular dependency. @@ -346,6 +350,10 @@ func BuildBasicFilter(block *wire.MsgBlock, prevOutScripts [][]byte) (*gcs.Filte // In the second pass, we'll also add all the prevOutScripts // individually as elements. for _, prevScript := range prevOutScripts { + if len(prevScript) == 0 { + continue + } + b.AddEntry(prevScript) }