From 22ac4082a421b0a4c0c774f414653a374dfc57b9 Mon Sep 17 00:00:00 2001 From: ziggie Date: Tue, 2 Sep 2025 09:52:38 +0200 Subject: [PATCH] chainntfs: zero out pkscript in logging when taproot is enabled --- chainntnfs/txnotifier.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/chainntnfs/txnotifier.go b/chainntnfs/txnotifier.go index 57eee845c..af85c2980 100644 --- a/chainntnfs/txnotifier.go +++ b/chainntnfs/txnotifier.go @@ -356,11 +356,22 @@ func NewSpendRequest(op *wire.OutPoint, pkScript []byte) (SpendRequest, error) { // String returns the string representation of the SpendRequest. func (r SpendRequest) String() string { - if r.OutPoint != ZeroOutPoint { - return fmt.Sprintf("outpoint=%v, script=%v", r.OutPoint, - r.PkScript) + var ( + outpointStr = fmt.Sprintf("%v", r.OutPoint) + scriptStr = fmt.Sprintf("%v", r.PkScript) + ) + + if r.OutPoint == ZeroOutPoint { + outpointStr = "" } - return fmt.Sprintf("outpoint=, script=%v", r.PkScript) + + // If the pk script is all zeros, we blank the pk script. + // Currently we do not support taproot pk scripts for notifications. + if r.PkScript == ZeroTaprootPkScript { + scriptStr = " (taproot pk script not supported)" + } + + return fmt.Sprintf("outpoint=%s, script=%s", outpointStr, scriptStr) } // MatchesTx determines whether the given transaction satisfies the spend