Skip to content

Commit 0eb9961

Browse files
committed
fix: taproot signature is 64 bytes
1 parent b566dd7 commit 0eb9961

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/payments/p2tr.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function p2tr(a, opts) {
3737
internalPubkey: types_1.typeforce.maybe(types_1.typeforce.BufferN(32)),
3838
hash: types_1.typeforce.maybe(types_1.typeforce.BufferN(32)),
3939
pubkey: types_1.typeforce.maybe(types_1.typeforce.BufferN(32)),
40-
signature: types_1.typeforce.maybe(bscript.isCanonicalScriptSignature),
40+
signature: types_1.typeforce.maybe(types_1.typeforce.BufferN(64)),
4141
witness: types_1.typeforce.maybe(
4242
types_1.typeforce.arrayOf(types_1.typeforce.Buffer),
4343
),

test/fixtures/p2tr.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@
4747
"description": "address, output and witness from pubkey and signature",
4848
"arguments": {
4949
"pubkey": "ab610d22c801def8a1e02368d1b92018970eb52a729919705e8a1a2f60c750f5",
50-
"signature": "300602010002010001"
50+
"signature": "a251221c339a7129dd0b769698aca40d8d9da9570ab796a1820b91ab7dbf5acbea21c88ba8f1e9308a21729baf080734beaf97023882d972f75e380d480fd704"
5151
},
5252
"expected": {
5353
"name": "p2tr",
5454
"address": "bc1p4dss6gkgq8003g0qyd5drwfqrztsadf2w2v3juz73gdz7cx82r6sj7lcqx",
5555
"output": "OP_1 ab610d22c801def8a1e02368d1b92018970eb52a729919705e8a1a2f60c750f5",
5656
"input": null,
5757
"witness": [
58-
"300602010002010001"
58+
"a251221c339a7129dd0b769698aca40d8d9da9570ab796a1820b91ab7dbf5acbea21c88ba8f1e9308a21729baf080734beaf97023882d972f75e380d480fd704"
5959
]
6060
}
6161
},
@@ -908,9 +908,9 @@
908908
"exception": "Signature mismatch",
909909
"arguments": {
910910
"pubkey": "ab610d22c801def8a1e02368d1b92018970eb52a729919705e8a1a2f60c750f5",
911-
"signature": "300602010002010002",
911+
"signature": "a251221c339a7129dd0b769698aca40d8d9da9570ab796a1820b91ab7dbf5acbea21c88ba8f1e9308a21729baf080734beaf97023882d972f75e380d480fd704",
912912
"witness": [
913-
"300602010002010001"
913+
"607b8b5b5c8614757736e3d5811790636d2a8e2ea14418f8cff66b2e898b3b7536a49b7c4bc8b3227953194bf5d0548e13e3526fdb36beeefadda1ec834a0db2"
914914
]
915915
}
916916
},

ts_src/payments/p2tr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export function p2tr(a: Payment, opts?: PaymentOpts): Payment {
4747
internalPubkey: typef.maybe(typef.BufferN(32)),
4848
hash: typef.maybe(typef.BufferN(32)),
4949
pubkey: typef.maybe(typef.BufferN(32)),
50-
signature: typef.maybe(bscript.isCanonicalScriptSignature),
50+
signature: typef.maybe(typef.BufferN(64)),
5151
witness: typef.maybe(typef.arrayOf(typef.Buffer)),
5252
// scriptsTree: typef.maybe(typef.TaprootNode), // use merkel.isMast ?
5353
scriptLeaf: typef.maybe({

0 commit comments

Comments
 (0)