From 46d39f9c2c4453718ee9241b0f3cafc952d126d8 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 14 Jun 2018 19:44:04 -0700 Subject: [PATCH] gcs/builder: skip OP_RETURN outputs when for regular filter --- gcs/builder/builder.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcs/builder/builder.go b/gcs/builder/builder.go index 0343c7f..5712df8 100644 --- a/gcs/builder/builder.go +++ b/gcs/builder/builder.go @@ -331,6 +331,14 @@ 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 { + // 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. + if txOut.PkScript[0] == txscript.OP_RETURN && + txscript.IsPushOnlyScript(txOut.PkScript[1:]) { + continue + } + b.AddEntry(txOut.PkScript) } }