Skip to content

Commit 5e91d4c

Browse files
committed
chainreg: accommodate buried taproot deployment in Bitcoin Core v31
Removes "taproot" from deployments: bitcoin/bitcoin#26201 Adds "script_flags" field to RPC getdeploymentinfo: bitcoin/bitcoin#32998
1 parent 314f122 commit 5e91d4c

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

chainreg/taproot_check.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package chainreg
22

33
import (
44
"encoding/json"
5+
"slices"
56

67
"github.com/btcsuite/btcd/rpcclient"
78
)
@@ -48,6 +49,7 @@ func backendSupportsTaproot(rpc *rpcclient.Client) bool {
4849
}
4950

5051
info := struct {
52+
ScriptFlags []string `json:"script_flags"`
5153
Deployments map[string]struct {
5254
Type string `json:"type"`
5355
Active bool `json:"active"`
@@ -59,6 +61,13 @@ func backendSupportsTaproot(rpc *rpcclient.Client) bool {
5961
return false
6062
}
6163

64+
// Before Bitcoin Core v31, taproot was still included as a BIP9 deployment.
6265
_, ok := info.Deployments["taproot"]
63-
return ok
66+
67+
// Since v31, taproot is activated at genesis and no longer appears
68+
// as a deployment. Also in v31, Bitcoin Core added a "script_flags"
69+
// field to getdeploymentinfo which lists all the verification flags.
70+
hasFlag := slices.Contains(info.ScriptFlags, "TAPROOT")
71+
72+
return ok || hasFlag
6473
}

0 commit comments

Comments
 (0)