Skip to content

Commit 3950c6a

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 3950c6a

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

chainreg/taproot_check.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func backendSupportsTaproot(rpc *rpcclient.Client) bool {
4848
}
4949

5050
info := struct {
51+
ScriptFlags []string `json:"script_flags"`
5152
Deployments map[string]struct {
5253
Type string `json:"type"`
5354
Active bool `json:"active"`
@@ -59,6 +60,21 @@ func backendSupportsTaproot(rpc *rpcclient.Client) bool {
5960
return false
6061
}
6162

63+
// Before Bitcoin Core v31, taproot was still included as a BIP9 deployment.
6264
_, ok := info.Deployments["taproot"]
63-
return ok
65+
66+
// Since v31, taproot is activated at genesis and no longer appears
67+
// as a deployment. Also in v31, Bitcoin Core added a "script_flags"
68+
// field to getdeploymentinfo which lists all the verification flags.
69+
hasFlag := false
70+
if info.ScriptFlags != nil {
71+
for _, f := range info.ScriptFlags {
72+
if f == "TAPROOT" {
73+
hasFlag = true
74+
break
75+
}
76+
}
77+
}
78+
79+
return ok || hasFlag
6480
}

0 commit comments

Comments
 (0)