Skip to content

Commit b5e647c

Browse files
jharveybRoasbeef
authored andcommitted
tapgarden+tapscript: use P2TR dummy outputs
1 parent 6eb255c commit b5e647c

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

tapgarden/caretaker.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package tapgarden
22

33
import (
4+
"bytes"
45
"context"
56
"errors"
67
"fmt"
@@ -30,8 +31,10 @@ import (
3031
var (
3132
// GenesisDummyScript is a dummy script that we'll use to fund the
3233
// initial PSBT packet that'll create initial set of assets. It's the
33-
// same size as a encoded P2TR output.
34-
GenesisDummyScript [34]byte
34+
// same size as a encoded P2TR output and has a valid P2TR prefix.
35+
GenesisDummyScript = append(
36+
[]byte{0x51, 0x20}, bytes.Repeat([]byte{0x00}, 32)...,
37+
)
3538

3639
// DummyGenesisTxOut is the dummy TxOut we'll place in the PSBt funding
3740
// request to make sure we leave enough room for change and fees.

tapscript/send.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package tapscript
22

33
import (
4+
"bytes"
45
"context"
56
"encoding/hex"
67
"errors"
@@ -107,10 +108,13 @@ var (
107108
// createDummyOutput creates a new Bitcoin transaction output that is later
108109
// used to embed a Taproot Asset commitment.
109110
func createDummyOutput() *wire.TxOut {
110-
// The dummy PkScript is the same size as an encoded P2TR output.
111+
// The dummy PkScript is the same size as an encoded P2TR output and has
112+
// a valid P2TR prefix.
111113
newOutput := wire.TxOut{
112-
Value: int64(DummyAmtSats),
113-
PkScript: make([]byte, 34),
114+
Value: int64(DummyAmtSats),
115+
PkScript: append(
116+
[]byte{0x51, 0x20}, bytes.Repeat([]byte{0x00}, 32)...,
117+
),
114118
}
115119
return &newOutput
116120
}

0 commit comments

Comments
 (0)