Skip to content

sn_lnd: Fix wallet.db + add new pk and addr to .env.dev #2185

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 1 commit into from
May 27, 2025

Conversation

sutt
Copy link
Contributor

@sutt sutt commented May 27, 2025

Description

Close #2183

PR #2179 replaces lnd/sn/wallet.db, which means:

  • new pubkey for the lnd node
  • new address to fund the node

This PR adds an address ("account"?) to sn_lnd wallet via: lncli newaddress p2wkh. This allows the node to scan the chain for that address on startup. (Previously there were no address generated so it did not search for any)

After that action, wallet.db is exported from the docker volume to replace the existing blob in the repo.

That generated address (bcrt1qu...sjw) is also added to .env. This allows the minecron script to send coins to the node on regtest init.

The new wallet.db introduced in #2179 also changed the node's pubkey, so that .env is also updated accodingly to what shows up for sn_lnd's lncli getinfo .identity_pubkey

Now, when starting a fresh environment, sn_lnd will be able to recieve coins and open channels, allowing sn_lnd to accept lightning payments.

Screenshots

Additional Context

After generating the address, lncli wallet addresses list prints:
(before running this command it prints empty list [])

{
    "account_with_addresses":  [
        {
            "name":  "default",
            "address_type":  "WITNESS_PUBKEY_HASH",
            "derivation_path":  "m/84'/0'/0'",
            "addresses":  [
                {
                    "address":  "bcrt1qu6g49vrl8n4ay99hr04wefkfy2e8g0z4nc0sjw",
                    "is_internal":  false,
                    "balance":  "490000000000",
                    "derivation_path":  "m/84'/0'/0'/0/0",
                    "public_key":  "02b75df0bfe79f27fbc293728c97e97f39e179b82dbea4767240f3d41987b66de1"
                }
            ]
        },

Was anything unclear during your work on this PR? Anything we should definitely take a closer look at?

I'm far from an LND expert here, but this is what worked after a lot of compariosn against the lnd container which did work properly on startup.

Checklist

Are your changes backwards compatible? Please answer below:
N/A?

On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:
8
This creates a side effect change around an eclair channels edge case thing I'm going to file today.

For frontend changes: Tested on mobile, light and dark mode? Please answer below:

Did you introduce any new environment variables? If so, call them out explicitly here:
No but I updated the values of SN_LND_PUBKEY, SN_LND_ADDR

@ekzyis ekzyis self-requested a review May 27, 2025 21:12
@huumn
Copy link
Member

huumn commented May 27, 2025

This fixes it. I was able to successfully withdraw. Thanks!

@huumn huumn merged commit 8c1b8d3 into stackernews:master May 27, 2025
6 checks passed
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.

Regression in local regtest setup
2 participants