Skip to content

chain: add testnet4 support #9620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 24, 2025
Merged

Conversation

guggero
Copy link
Collaborator

@guggero guggero commented Mar 20, 2025

Adds testnet4 support to lnd.

Fixes #8966.

Depends on btcsuite/btcwallet#994 and lightninglabs/neutrino#311.

Copy link
Contributor

coderabbitai bot commented Mar 20, 2025

Important

Review skipped

Auto reviews are limited to specific labels.

🏷️ Labels to auto review (1)
  • llm-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Impa10r
Copy link

Impa10r commented Mar 20, 2025

builds fine, but cannot bootstrap:

2025-03-20 22:09:29.545 [INF] DISC: Attempting to bootstrap with: Authenticated Channel Graph
2025-03-20 22:09:29.547 [ERR] SRVR: Unable to retrieve initial bootstrap peers: no addresses found

don't know if related or not, create followed by getinfo also fails:

~ $ lncli create
Input wallet password:
Confirm password:

Do you have an existing cipher seed mnemonic or extended master root key you want to use?
Enter 'y' to use an existing cipher seed mnemonic, 'x' to use an extended master root key
or 'n' to create a new seed (Enter y/x/n): n

Your cipher seed can optionally be encrypted.
Input your passphrase if you wish to encrypt it (or press enter to proceed without a cipher seed passphrase):

Generating fresh cipher seed...

!!!YOU MUST WRITE DOWN THIS SEED TO BE ABLE TO RESTORE THE WALLET!!!

---------------BEGIN LND CIPHER SEED---------------
 ...
---------------END LND CIPHER SEED-----------------

!!!YOU MUST WRITE DOWN THIS SEED TO BE ABLE TO RESTORE THE WALLET!!!

lnd successfully initialized!
~ $ lncli getinfo
[lncli] rpc error: code = Unknown desc = verification failed: signature mismatch after caveat verification

@Roasbeef
Copy link
Member

builds fine, but cannot bootstrap:
2025-03-20 22:09:29.547 [ERR] SRVR: Unable to retrieve initial bootstrap peers: no addresses found

So it's an entirely new network. Someone needs to run DNS seed infrastructure for it, but none for the network currently exist at present.

don't know if related or not, create followed by getinfo also fails:

I suspect some code is still using the testnet3 path when it should be using the testnet4 path (or you forgot to set the flag in lncli).

@@ -22,6 +22,14 @@ var BitcoinTestNetParams = BitcoinNetParams{
CoinType: keychain.CoinTypeTestnet,
}

// BitcoinTestNet4Params contains parameters specific to the 4th version of the
Copy link
Member

Choose a reason for hiding this comment

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

We should also update lncli to mention that testnet4 is an option for the --network command.

Copy link

@Impa10r Impa10r Mar 20, 2025

Choose a reason for hiding this comment

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

yep

$ lncli  --network=testnet4 getinfo
[lncli] could not load global options: unknown network: testnet4

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did add that. Are you sure you re-compiled and installed lncli from the branch?

Copy link

Choose a reason for hiding this comment

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

yes, tried again, now lncli works, but lnd does not create admin.macaroon

~ $ lnd
2025-03-24 21:46:49.302 [WRN] LTND: Config 'dust-threshold' is deprecated, please remove it
2025-03-24 21:46:49.302 [INF] LTND: Version Info rev=d757bb version=0.18.99-beta commit=tor/v1.1.6-109-gd757bb51e debuglevel=production logging=info
2025-03-24 21:46:49.302 [INF] LTND: Network Info rev=d757bb active_chain=Bitcoin network=testnet4
2025-03-24 21:46:49.303 [INF] RPCS: RPC server listening on 0.0.0.0:10009
2025-03-24 21:46:49.335 [INF] RPCS: gRPC proxy started at 127.0.0.1:8080
2025-03-24 21:46:49.336 [INF] LTND: Opening the main database, this might take a few minutes...
2025-03-24 21:46:49.336 [INF] LTND: Opening bbolt database, sync_freelist=false, auto_compact=false
2025-03-24 21:46:49.351 [INF] LTND: Creating local graph and channel state DB instances
2025-03-24 21:46:49.360 [INF] CHDB: Checking for schema update: latest_version=33, db_version=33
2025-03-24 21:46:49.360 [INF] CHDB: Checking for optional update: prune_revocation_log=false, db_version=empty
2025-03-24 21:46:49.360 [INF] LTND: Database(s) now open (time_to_open=24.300106ms)!
2025-03-24 21:46:49.360 [INF] LTND: We're not running within systemd or the service type is not 'notify'
2025-03-24 21:46:49.360 [INF] LTND: Waiting for wallet encryption password. Use `lncli create` to create a wallet, `lncli unlock` to unlock an existing wallet, or `lncli changepassword` to change the password of an existing wallet and unlock it.

$ lncli --network=testnet4 getinfo
[lncli] could not load global options: unable to read macaroon path (check the network setting!): open /home/vlad/.lnd/data/chain/bitcoin/testnet4/admin.macaroon: no such file or directory

$ ls ~/.lnd/data/chain/bitcoin/testnet4
macaroons.db

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You need to unlock/create a wallet first.

Copy link
Member

Choose a reason for hiding this comment

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

Confirmed I can interact using lncli on testent4 np.

Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM 🏮

tACK

We'll work on standing up DNS infrastructure in the background so nodes can boostrap.

@Roasbeef Roasbeef merged commit 67d2eac into lightningnetwork:master Mar 24, 2025
34 of 35 checks passed
@twofaktor
Copy link
Contributor

twofaktor commented Mar 24, 2025

We'll work on standing up DNS infrastructure in the background so nodes can boostrap.

Will a testnet4 external fee estimator URL, such as https://nodes.lightning.computer/fees/v1/btctestnet4-fee-estimates.json, also be provided ?

@guggero guggero deleted the testnet4 branch March 25, 2025 13:13
@Impa10r
Copy link

Impa10r commented Mar 26, 2025

if anyone wants to open a testnet4 channel, do 50/50, or want me to open to them, ping t.me/MiddleWayNode

It will be up 24/7 at 03a17ec2c693c82d7b8d6616dcaf57cbfb0df506045612e08c9580b0c55dda2c1d@72elnf2w7ahgqkwhqfh3pjrxdtwdszpl3bqhly6ipx6agz4sc6kwkfid.onion:9735

@Impa10r
Copy link

Impa10r commented Mar 26, 2025

Hi @guggero. lncli reports all errors as "wallet is encrypted":

% lncli openchannel --node_key 030f289f0f931cd33cc3435dc5f5fc2a6a65bb0297327d43e82562aded10df74a7 --fee_rate_ppm 1 --local_amt 5000000
[lncli] wallet is encrypted - please unlock using 'lncli unlock', or set password using 'lncli create' if this is the first time starting lnd

while in the log:

2025-03-26 13:24:03.150 [INF] CHFD: Performing funding tx coin selection using 8626 sat/kw as fee rate
2025-03-26 13:24:03.150 [ERR] RPCS: unable to open channel to NodeKey(030f289f0f931cd33cc3435dc5f5fc2a6a65bb0297327d43e82562aded10df74a7): not enough witness outputs to create funding transaction, need 0.15000000 BTC only have 0 BTC available
2025-03-26 13:24:03.151 [ERR] RPCS: [/lnrpc.Lightning/OpenChannel]: not enough witness outputs to create funding transaction, need 0.15000000 BTC only have 0 BTC available

@guggero
Copy link
Collaborator Author

guggero commented Mar 26, 2025

Can you create a new issue please? Might be a bug introduced by #9605.

@adambor
Copy link

adambor commented May 10, 2025

if anyone needs a channel peer on clearnet, feel free to connect and open a channel: 024c6e1edd12f0792d0c1ddda3abc6e2fde6bf89f2848e00cf8d6a58fabb6c3ab6@81.17.102.136:9735

@twofaktor
Copy link
Contributor

twofaktor commented May 16, 2025

LGTM 🏮

tACK

We'll work on standing up DNS infrastructure in the background so nodes can boostrap.

We're already on rc5, and the mentioned infrastructure hasn't been implemented yet. Is it planned to be operational by the final version of v0.19.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature]: testnet4 support
5 participants