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,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}
You can’t perform that action at this time.
0 commit comments