File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package chainreg
22
33import (
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,14 @@ func backendSupportsTaproot(rpc *rpcclient.Client) bool {
5961 return false
6062 }
6163
64+ // Before Bitcoin Core v31, taproot was still included as a BIP9
65+ // deployment.
6266 _ , ok := info .Deployments ["taproot" ]
63- return ok
67+
68+ // Since v31, taproot is activated at genesis and no longer appears
69+ // as a deployment. Also in v31, Bitcoin Core added a "script_flags"
70+ // field to getdeploymentinfo which lists all the verification flags.
71+ hasFlag := slices .Contains (info .ScriptFlags , "TAPROOT" )
72+
73+ return ok || hasFlag
6474}
You can’t perform that action at this time.
0 commit comments