File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -27,16 +27,24 @@ func GetTaprootAddress(script []byte) (*btcutil.AddressTaproot, error) {
27
27
// Branch 1: multisig signature script
28
28
func createMultisigScript (pubKeys []string ) ([]byte , error ) {
29
29
builder := txscript .NewScriptBuilder ()
30
- builder .AddInt64 (int64 (len (pubKeys ))) // Threshold: 2 signatures required
31
- for _ , pubKeyHex := range pubKeys {
30
+ for i , pubKeyHex := range pubKeys {
32
31
pubKey , err := hex .DecodeString (pubKeyHex )
33
32
if err != nil {
34
33
return nil , err
35
34
}
35
+
36
36
builder .AddData (pubKey )
37
+
38
+ if i == 0 {
39
+ builder .AddOp (txscript .OP_CHECKSIG )
40
+ } else {
41
+ builder .AddOp (txscript .OP_CHECKSIGADD )
42
+ }
37
43
}
38
- builder .AddInt64 (int64 (len (pubKeys ))) // Total keys
39
- builder .AddOp (txscript .OP_CHECKMULTISIG )
44
+
45
+ builder .AddInt64 (int64 (len (pubKeys )))
46
+ builder .AddOp (txscript .OP_NUMEQUAL )
47
+
40
48
return builder .Script ()
41
49
}
42
50
You can’t perform that action at this time.
0 commit comments