Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion chainreg/taproot_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package chainreg

import (
"encoding/json"
"slices"

"github.com/btcsuite/btcd/rpcclient"
)
Expand Down Expand Up @@ -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"`
Expand All @@ -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
}
5 changes: 5 additions & 0 deletions docs/release-notes/release-notes-0.21.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -382,6 +386,7 @@
* Erick Cestari
* Gijs van Dam
* hieblmi
* Matthew Zipkin
* Mohamed Awnallah
* Nishant Bansal
* Pins
Expand Down
Loading