mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 14:40:51 +02:00
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.
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user