txscript: switch template engine from html/template to text/template

html/template automatically HTML-escapes special characters to prevent
XSS, which can silently corrupt arbitrary script data. Since the output
is binary script bytes and not HTML, this escaping provides no benefit
and might breaks correctness.
This commit is contained in:
Erick Cestari 2026-03-10 10:36:57 -03:00
parent cac334b6aa
commit d36b9ded6d
No known key found for this signature in database
GPG key ID: D7D17E26F2FC3F3C

View file

@ -5,9 +5,9 @@ import (
"bytes"
"encoding/hex"
"fmt"
"html/template"
"strconv"
"strings"
"text/template"
)
// ScriptTemplateOpt is a function type for configuring the script template.
@ -103,7 +103,6 @@ func looksLikeInt(s string) bool {
return len(s) > 0
}
// processScript converts the template output to actual script bytes. We scan
// each line, then go through each element one by one, deciding to either add a
// normal op code, a push data, or an integer value.