diff --git a/chainreg/taproot_check.go b/chainreg/taproot_check.go index dedc717eb3d..45c5c5b1945 100644 --- a/chainreg/taproot_check.go +++ b/chainreg/taproot_check.go @@ -2,6 +2,7 @@ package chainreg import ( "encoding/json" + "slices" "github.com/btcsuite/btcd/rpcclient" ) @@ -48,6 +49,7 @@ func backendSupportsTaproot(rpc *rpcclient.Client) bool { } info := struct { + ScriptFlags []string `json:"script_flags"` Deployments map[string]struct { Type string `json:"type"` Active bool `json:"active"` @@ -59,6 +61,14 @@ func backendSupportsTaproot(rpc *rpcclient.Client) bool { return false } + // Before Bitcoin Core v31, taproot was still included as a BIP9 + // deployment. _, ok := info.Deployments["taproot"] - return ok + + // Since v31, taproot is activated at genesis and no longer appears + // as a deployment. Also in v31, Bitcoin Core added a "script_flags" + // field to getdeploymentinfo which lists all the verification flags. + hasFlag := slices.Contains(info.ScriptFlags, "TAPROOT") + + return ok || hasFlag } diff --git a/docs/release-notes/release-notes-0.21.0.md b/docs/release-notes/release-notes-0.21.0.md index ad58f77da7f..10bf65efac9 100644 --- a/docs/release-notes/release-notes-0.21.0.md +++ b/docs/release-notes/release-notes-0.21.0.md @@ -360,6 +360,10 @@ ## Code Health +* [Update taproot detection](https://github.com/lightningnetwork/lnd/pull/10683) + to accommodate buried activation (and modified RPC `getdeploymentinfo` + response) beginning in Bitcoin Core v32. + ## Tooling and Documentation * [Added missing `lncli:` tags](https://github.com/lightningnetwork/lnd/pull/10658) @@ -382,6 +386,7 @@ * Erick Cestari * Gijs van Dam * hieblmi +* Matthew Zipkin * Mohamed Awnallah * Nishant Bansal * Pins