From 6ce7f5d29e98b46751f159d93514f21ba760bb5c Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 24 May 2023 20:57:20 -0700 Subject: [PATCH] input: use explicit CSV 1 script for to remote output We undo the prior hack here to make the final script more readable. The difference is just 1 byte between the two. --- input/script_utils.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/input/script_utils.go b/input/script_utils.go index dabcf92ab..200a24a35 100644 --- a/input/script_utils.go +++ b/input/script_utils.go @@ -2231,7 +2231,9 @@ func NewRemoteCommitScriptTree(remoteKey *btcec.PublicKey, builder := txscript.NewScriptBuilder() builder.AddData(schnorr.SerializePubKey(remoteKey)) builder.AddOp(txscript.OP_CHECKSIG) + builder.AddOp(txscript.OP_1) builder.AddOp(txscript.OP_CHECKSEQUENCEVERIFY) + builder.AddOp(txscript.OP_DROP) remoteScript, err := builder.Script() if err != nil { @@ -2269,12 +2271,7 @@ func NewRemoteCommitScriptTree(remoteKey *btcec.PublicKey, // Our single tapleaf will use the following script: // // OP_CHECKSIG -// OP_CHECKSEQUENCEVERIFY -// -// The CSV clause is a bit subtle, but OP_CHECKSIG will return true if it -// succeeds, which then enforces our 1 CSV. The true will remain on the stack, -// causing the script to pass. If the CHECKSIG fails, then a 0 will remain on -// the stack. +// 1 OP_CHECKSEQUENCEVERIFY OP_DROP func TaprootCommitScriptToRemote(remoteKey *btcec.PublicKey, ) (*btcec.PublicKey, error) {