Skip to content

multi: update to btcd v2 modules#10920

Closed
ellemouton wants to merge 1 commit into
lightningnetwork:masterfrom
ellemouton:ellemouton/btcd-v2-modules
Closed

multi: update to btcd v2 modules#10920
ellemouton wants to merge 1 commit into
lightningnetwork:masterfrom
ellemouton:ellemouton/btcd-v2-modules

Conversation

@ellemouton

Copy link
Copy Markdown
Collaborator

Summary

btcd v0.26.0 split several packages out of the root module into their own
per-package /v2 modules (wire, txscript, chaincfg, chainhash,
btcutil, psbt). This updates lnd to the new layout.

Changes

  • Import-path bumps across the main module: wirewire/v2,
    txscripttxscript/v2, chaincfgchaincfg/v2,
    chaincfg/chainhashchainhash/v2, btcutilbtcutil/v2,
    btcutil/psbtpsbt/v2; btcec/v2 bumped to v2.5.0.
  • The address-related symbols that moved out of btcutil into the new
    address package (Hash160, DecodeAddress, the Address* types and the
    NewAddress* constructors) are imported with a btcaddr alias to avoid
    shadowing by the many local address variables in the codebase.
  • bech32 remains on the v1 btcutil/bech32 path (the btcutil v1.x compat
    module), as it did not move into btcutil/v2.
  • The tlv and tor sub-modules were already migrated upstream and are left
    unchanged.

Status / dependencies

Draft until the rest of the btcd-v2 stack lands and is tagged; the migrated
dependencies are pinned via temporary replace directives in the meantime:

Testing

go build ./... and go vet ./... (including test compilation) pass.

Bump btcd to v0.26.0 and adopt its new per-package v2 modules: wire/v2,
txscript/v2, chaincfg/v2, chainhash/v2, btcutil/v2, psbt/v2, and
btcec/v2 v2.5.0. The address symbols that moved out of btcutil into the
new address package (Hash160, DecodeAddress, the Address types and the
NewAddress* constructors) are imported as btcaddr to avoid shadowing by
local "address" variables. bech32 stays on the v1 btcutil path.

The migrated dependencies are pulled in via temporary replaces until
they are tagged: btcwallet, neutrino, and lightning-onion.

btcec/v2 v2.5.0 requires Go 1.25, so the Go version is bumped to
1.25.11.
@github-actions github-actions Bot added the severity-critical Requires expert review - security/consensus critical label Jun 23, 2026
@github-actions

Copy link
Copy Markdown

🔴 PR Severity: CRITICAL

First-pass classification | 100+ files | 3,011 lines changed (1,543 additions + 1,468 deletions)

🔴 Critical (30+ files)
  • channeldb/channel.go - Channel state persistence (channeldb/*)
  • channeldb/codec.go - Channel state persistence (channeldb/*)
  • channeldb/db.go - Channel state persistence (channeldb/*)
  • channeldb/migration/lnwire21/accept_channel.go - Database migration (always CRITICAL)
  • channeldb/migration/lnwire21/lnwire.go - Database migration (always CRITICAL)
  • channeldb/migration/lnwire21/open_channel.go - Database migration (always CRITICAL)
  • channeldb/migration12/invoices.go - Database migration (always CRITICAL)
  • channeldb/migration16/migration.go - Database migration (always CRITICAL)
  • channeldb/migration20/codec.go - Database migration (always CRITICAL)
  • channeldb/migration20/migration.go - Database migration (always CRITICAL)
  • channeldb/migration21/common/enclosed_types.go - Database migration (always CRITICAL)
  • channeldb/migration21/current/current_codec.go - Database migration (always CRITICAL)
  • channeldb/migration21/legacy/legacy_codec.go - Database migration (always CRITICAL)
  • channeldb/migration29/codec.go - Database migration (always CRITICAL)
  • channeldb/migration29/migration.go - Database migration (always CRITICAL)
🟠 High (10+ files)
  • chainntnfs/best_block_view.go - Chain notification service
  • chainntnfs/bitcoindnotify/bitcoind.go - Chain notification service
  • chainntnfs/btcdnotify/btcd.go - Chain notification service
  • chainntnfs/interface.go - Chain notification service
  • chainntnfs/txnotifier.go - Chain notification service
  • chanacceptor/interface.go - Channel acceptor
  • chanacceptor/rpcacceptor.go - Channel acceptor
🟡 Medium (20+ files)
  • autopilot/agent.go - Autopilot
  • chanbackup/backup.go - Channel backup
  • chanfitness/chaneventstore.go - Channel fitness
  • chainreg/chainregistry.go - Chain registry
  • channel_notifier.go - Root-level notifier

Analysis

This PR updates lnd to the btcd v2 module layout, splitting packages into per-package /v2 modules (wire/v2, txscript/v2, chaincfg/v2, chainhash/v2, btcutil/v2, psbt/v2). It is a mass import-path refactor spanning the entire codebase.

Why CRITICAL:

  • channeldb/* files are present (channel state persistence).
  • channeldb/migration* files are present — database migrations are always CRITICAL.
  • All bump criteria met: 67+ non-test files (>20), 3,011 lines changed (>500), multiple distinct critical packages.

Review focus:

  1. Correct btcaddr alias usage where local address variables exist.
  2. btcutil API surface moved to the address sub-package in migration code.
  3. Temporary go.mod replace directives must be removed before merging to main.

To override, add a severity-override-{critical,high,medium,low} label.
<!-- pr-severity-bot -->

@ellemouton

Copy link
Copy Markdown
Collaborator Author

Superseded by #10913 (guggero's canonical 'Update everything to btcd v2 modules'), which is the coordinated ecosystem migration and now pins the tagged versions directly. Closing in favor of that.

@ellemouton ellemouton closed this Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

severity-critical Requires expert review - security/consensus critical

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant