Skip to content

Update everything to btcd v2 modules#10913

Merged
ziggie1984 merged 2 commits into
lightningnetwork:masterfrom
guggero:btcd-v2-modules
Jun 25, 2026
Merged

Update everything to btcd v2 modules#10913
ziggie1984 merged 2 commits into
lightningnetwork:masterfrom
guggero:btcd-v2-modules

Conversation

@guggero

@guggero guggero commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Depends on:

Change Description

After merging btcsuite/btcd#1825, we'll need to update all btcd dependencies to the new v2 modules.

With the PRs linked above, we have everything we need to update lnd to consume the new modules.

BUT: This will have quite a big impact on the wider ecosystem, as changing lnd will require all of the following projects to also update in order to ever be able to build litd again:

  • Loop
  • Pool
  • Faraday
  • Taproot Assets
  • Lightning Terminal
  • Server components of above mentioned projects

So keep that in mind when merging.

Though eventually this needs to be done, as the following PRs are now directly blocked on this:

Steps to Test

No functional changes, a green CI should

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request updates the lnd project to consume the new v2 modules of btcd. This is a foundational change required to support recent updates in the btcsuite ecosystem. While this update is necessary to unblock other development efforts, it necessitates a coordinated update across the wider Lightning ecosystem projects to ensure continued build compatibility.

Highlights

  • Dependency Update: Updated all btcd dependencies to their new v2 modules, following the recent changes in btcd.
  • Module Migration: Migrated imports across the codebase to reflect the new v2 module paths for btcutil, chaincfg, chainhash, txscript, wire, and others.
  • Ecosystem Impact: Noted that this change requires downstream projects (Loop, Pool, Faraday, Taproot Assets, Lightning Terminal) to also update their dependencies to remain compatible.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions Bot added the severity-critical Requires expert review - security/consensus critical label Jun 19, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request performs a major dependency upgrade across the codebase, transitioning various github.com/btcsuite/btcd sub-modules (such as btcutil, wire, chaincfg, chainhash, txscript, and psbt) to their v2 versions, and introducing address/v2. The review feedback highlights that the go.mod file currently relies on personal forks in its replace block for several critical dependencies, which must be replaced with official tagged releases before merging to prevent security risks and dependency resolution issues for downstream projects.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread go.mod Outdated
Comment on lines +245 to +254
replace (
github.com/btcsuite/btcwallet => github.com/guggero/btcwallet v0.13.1-0.20260619113612-9ea600d63685
github.com/btcsuite/btcwallet/wallet/txauthor => github.com/guggero/btcwallet/wallet/txauthor v1.1.1-0.20260619113612-9ea600d63685
github.com/btcsuite/btcwallet/wallet/txrules => github.com/guggero/btcwallet/wallet/txrules v1.1.1-0.20260619113612-9ea600d63685
github.com/btcsuite/btcwallet/wallet/txsizes => github.com/guggero/btcwallet/wallet/txsizes v1.1.1-0.20260619113612-9ea600d63685
github.com/btcsuite/btcwallet/walletdb => github.com/guggero/btcwallet/walletdb v1.4.1-0.20260619113612-9ea600d63685
github.com/btcsuite/btcwallet/wtxmgr => github.com/guggero/btcwallet/wtxmgr v1.3.1-0.20260619113612-9ea600d63685
github.com/lightninglabs/neutrino => github.com/guggero/neutrino v0.11.1-0.20260619073835-e49be6c9c0ef
github.com/lightningnetwork/lightning-onion => github.com/guggero/lightning-onion v1.0.2-0.20260619140053-067e4a7cd61b
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The replace block uses personal forks (github.com/guggero/...) for several critical dependencies. Before this pull request is merged, these temporary replacements must be removed and replaced with official tagged releases of the upstream repositories. Relying on personal forks in a merged release of lnd introduces security risks and breaks dependency resolution for downstream projects (such as Loop, Pool, Faraday, etc.) that consume lnd as a module.

@github-actions

Copy link
Copy Markdown

PR Severity: CRITICAL. This PR (Update everything to btcd v2 modules) touches channeldb/channel.go, channeldb/codec.go, channeldb/db.go (CRITICAL: channeldb/), and 23 channeldb migration files (always CRITICAL per DB migration rule), plus 19 HIGH chainntnfs/ and chanacceptor/* files. 68 non-test files changed exceeds the 20-file bump threshold; 3509 total lines changed exceeds the 500-line bump threshold. Classification was already CRITICAL. <!-- pr-severity-bot -->

@ellemouton ellemouton force-pushed the btcd-v2-modules branch 2 times, most recently from 58cb41c to 26c3ce1 Compare June 24, 2026 17:37
@ellemouton ellemouton marked this pull request as ready for review June 24, 2026 17:37
Migrate all btcd dependencies to the new per-package v2 modules (wire/v2,
txscript/v2, chaincfg/v2, chainhash/v2, btcutil/v2, psbt/v2, btcec/v2)
introduced by btcd v0.26.0, and pin the tagged ecosystem versions:
btcwallet v0.17.0, neutrino v0.18.0 and lightning-onion v1.4.0.

The bulk of the import rewrite was produced by the scripted diff from
btcsuite/btcd#2547 (followed by 'make rpc'). The
address symbols that moved out of btcutil into the new address package
are imported as btcaddr where a local "address" variable would otherwise
shadow them. The go.mod/go.sum updates and the remaining manual
compilation fixes are folded into this single commit so it builds on its
own (the migration was previously split into a reproducible scripted-diff
plus follow-ups, intended to be squashed on merge).
The btcd v2 module migration re-touched several lines that the line-length
linter then flagged, and left one error return unchecked. Wrap the
over-length lines in input/test_utils.go and zpay32 (the address-decode
helpers and test fixtures whose btcutil->address rename lengthened them),
and check the LoadTxFilter error return in routing/chainview/btcd.go.
@ziggie1984 ziggie1984 self-requested a review June 24, 2026 20:54
@ellemouton ellemouton requested a review from Roasbeef June 24, 2026 20:59

@Roasbeef Roasbeef left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🌜

@ziggie1984

Copy link
Copy Markdown
Collaborator

/gateway review

@lightninglabs-gateway

lightninglabs-gateway Bot commented Jun 25, 2026

Copy link
Copy Markdown

❌ gateway review failed: could not fetch PR context: {"level":"info","script":"fetch-pr-context.sh","event":"fetch","outcome":"attempt","step":"pr","path":"repos/lightningnetwork/lnd/pulls/10913"} {"level":"info","script":"fetch-pr-context.sh","event":"fetch","outcome":"attempt","step":"diff","path":"repos/lightningnetwork/lnd/pulls/10913"} {"level":"error","script":"fetch-pr-context.sh","event":"fetch_diff","outcome":"failure","message":"fetch diff failed: gh: Sorry, the diff exceeded the maximum number of files (300). Consider using 'List pull requests files' API or locally cloning the repository instead. (HTTP 406) "}

See workflow logs for details.

@ziggie1984 ziggie1984 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Reminder:

A lot of new replacement directives which we need to eventually tag and cleanup.

@ziggie1984 ziggie1984 merged commit 0dbe2b1 into lightningnetwork:master Jun 25, 2026
40 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog severity-critical Requires expert review - security/consensus critical

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants