Skip to content

Conversation

@bhandras
Copy link
Collaborator

@bhandras bhandras commented Jan 6, 2026

Summary

This PR extends lntest with a bitcoind-backed miner implementation. Until now, lntest assumed a btcd miner (rpctest harness) even when the chain backend was bitcoind, which made it hard to exercise Bitcoin Core-specific
mining and mempool behavior.

A key motivation for this work is enabling lntest to support mining and validating v3 packages (and other Core policy/package-relay behaviors) in integration tests. Those workflows are most realistically exercised with Bitcoin Core as the miner.

What’s included

  • New miner abstraction in lntest/miner with two concrete backends:
    • btcd backend (wrapping existing rpctest.Harness usage)
    • bitcoind backend (spawns a local bitcoind on regtest and implements the miner APIs needed by lntest)
  • Harness updates to avoid btcd-only assumptions:
    • Miner lifecycle is routed through the backend interface.
    • Miner RPC calls (e.g. raw tx submission) go through the miner backend.
    • Funding-shim output index handling is made robust across backends.
  • Test runner support:
    • Add -minerbackend itest flag so the miner backend can be selected independently from the chain backend.
    • Add a build-tag default for the miner backend.
  • CI coverage:
    • Add a CI itest matrix entry that runs with backend=bitcoind and minerbackend=bitcoind to ensure we exercise the new path.

Why this matters for v3 packages

Package relay / v3 transaction workflows are fundamentally Bitcoin Core policy and mining driven. Having lntest able to:

  • talk to a Core-backed miner,
  • submit transactions via Core,
  • mine blocks via Core,

is a prerequisite for writing reliable integration coverage around v3 package construction, acceptance, and mining behavior.

How to run

Locally:

  • make itest backend=bitcoind minerbackend=bitcoind

CI will run an additional job (matrix entry) with the same arguments.

Notes

  • Default behavior remains unchanged (btcd miner unless explicitly selected).
  • make lint passes.

@gemini-code-assist
Copy link

Summary of Changes

Hello @bhandras, 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 significantly enhances the lntest framework by introducing a bitcoind-backed miner implementation. Previously, lntest relied solely on btcd for mining, even when bitcoind was used as the chain backend. This change provides a more realistic testing environment for Bitcoin Core-specific behaviors, such as those related to v3 transaction packages and mempool policies. By abstracting the miner backend, the framework becomes more flexible and robust, enabling comprehensive integration testing for advanced Bitcoin features.

Highlights

  • Bitcoind Miner Backend: Introduced a new bitcoind-backed miner implementation for lntest, allowing integration tests to realistically exercise Bitcoin Core-specific mining and mempool behavior, especially for v3 packages.
  • Miner Abstraction: A new lntest/miner abstraction was added, supporting both btcd and bitcoind as concrete miner backends, enhancing flexibility and future extensibility.
  • Harness Updates: The lntest.Harness was updated to route miner lifecycle and RPC calls through the new MinerBackend interface, removing btcd-only assumptions and standardizing interactions.
  • Configurable Miner Backend: Added a -minerbackend flag for integration tests, enabling independent selection of the miner backend from the chain backend, with build-tag defaults for convenience.
  • CI Coverage: Expanded the CI matrix to include tests with backend=bitcoind and minerbackend=bitcoind to ensure comprehensive coverage of the new bitcoind miner path.

🧠 New Feature in Public Preview: You can now enable Memory 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.

Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/main.yml
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 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 counter productive. 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

Copy link

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

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 introduces a bitcoind-backed miner implementation for lntest, which is a significant and well-executed enhancement. It allows for more realistic integration testing of Bitcoin Core-specific behaviors. The new miner abstraction is clean, and the refactoring of existing code to use it is thorough. My review includes one suggestion to improve maintainability by reducing code duplication in one of the modified files.

@bhandras bhandras force-pushed the lntest-bitcoind-miner branch from 524274d to 0872272 Compare January 6, 2026 15:32
@bhandras bhandras marked this pull request as draft January 6, 2026 17:35
@bhandras bhandras force-pushed the lntest-bitcoind-miner branch from 2a17ef9 to a8a24ed Compare January 6, 2026 17:39
@saubyk saubyk added this to v0.21 Jan 6, 2026
@saubyk saubyk moved this to In progress in v0.21 Jan 6, 2026
Introduce a miner backend interface and implement both btcd and
bitcoind-backed miners for lntest. This lets the harness drive mining
and mempool assertions using bitcoind in addition to btcd.

Also update harness helpers to avoid btcd-only assumptions (network
params, raw tx submission, funding shim output index lookup) and make
bitcoind miner disconnects more reliable.
Add an itest flag to choose the miner backend (btcd vs bitcoind) and
provide a build-tag default so that `-tags=bitcoind` naturally uses a
bitcoind miner.

Wire the flag through `make testing_flags.mk` so callers can set
`minerbackend=bitcoind` independently of the chain backend.
Add a basic itest matrix entry that sets minerbackend=bitcoind alongside
backend=bitcoind, ensuring CI covers the bitcoind miner path.
@bhandras bhandras force-pushed the lntest-bitcoind-miner branch from a8a24ed to d2b5d3c Compare January 6, 2026 19:09
@bhandras bhandras marked this pull request as ready for review January 6, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

1 participant