From 6b7abc3dbc7a98337fe5324db55d4519c1653841 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Fri, 12 Aug 2022 15:29:54 -0700 Subject: [PATCH] chainreg: update tapoort node awareness to account for bitcoind 19+ Bitcoind 23 will use the new `getdeploymentinfo` while versions after 19 (but below 23) will use the `UnifiedSoftForks` field instead of the `SoftForks UnifiedSoftForks` field. With this PR the taproot gating logic has been tested on bitcoind versions: 21, 22, and 23. 21 is when the taproot logic was first added. --- chainreg/taproot_check.go | 13 ++++++++++++- docs/release-notes/release-notes-0.15.1.md | 4 +++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/chainreg/taproot_check.go b/chainreg/taproot_check.go index 5528e9f71..dedc717eb 100644 --- a/chainreg/taproot_check.go +++ b/chainreg/taproot_check.go @@ -14,11 +14,22 @@ func backendSupportsTaproot(rpc *rpcclient.Client) bool { if err == nil { // If this call worked, then we'll check that the taproot // deployment is defined. - if chainInfo.SoftForks != nil { + switch { + // Bitcoind versions before 0.19 and also btcd use the + // SoftForks fields. + case chainInfo.SoftForks != nil: _, ok := chainInfo.SoftForks.Bip9SoftForks["taproot"] if ok { return ok } + + // Bitcoind versions after 0.19 will use the UnifiedSoftForks + // field that factors in the set of "buried" soft forks. + case chainInfo.UnifiedSoftForks != nil: + _, ok := chainInfo.UnifiedSoftForks.SoftForks["taproot"] + if ok { + return ok + } } } diff --git a/docs/release-notes/release-notes-0.15.1.md b/docs/release-notes/release-notes-0.15.1.md index 22af4ee08..fa4e7274f 100644 --- a/docs/release-notes/release-notes-0.15.1.md +++ b/docs/release-notes/release-notes-0.15.1.md @@ -30,7 +30,9 @@ of the draft BIP. ## Taproot [`lnd` will now refuse to start if it detects the full node backend does not -support Tapoot](https://github.com/lightningnetwork/lnd/pull/6798). +support Tapoot](https://github.com/lightningnetwork/lnd/pull/6798). [With this +change](https://github.com/lightningnetwork/lnd/pull/6826), the officially +supported versions of bitcoind are: 21, 22, and 23. [`lnd` will now use taproot addresses for co-op closes if the remote peer supports the feature.](https://github.com/lightningnetwork/lnd/pull/6633)