lightningnetwork / lnd

Lightning Network Daemon ⚡️
MIT License
7.55k stars 2.06k forks source link

[bug]: LND does not see transactions after the recovery procedure #8880

Open Perlover opened 1 week ago

Perlover commented 1 week ago

Background

My SSD drive died on my node. I had a fresh channel.backup file. But I haven't got to it yet, because LND after synchronisation doesn't see even old transactions inside the wallet. Although it is synchronised with the chain and network graph.

Your environment

Steps to reproduce

1) Create new .lnd empty directory with lnd.conf 2) Starting LND 3) I specified the password for the wallet, then specified the old seed and cipher seed phrase. 4) Waiting for LND to synchronise. But it shows walletbalance completely zero, and also does not see the first top-up transactions to the node's wallet (lncli listunspent). 5) Restarting LND does not help :(

Expected behaviour

I expect to see funds that were not in the channels (lncli walletbalance) as well as old transactions before recovery (lncli listunspent).

Actual behaviour

Once fully synchronised:

Once fully synchronised:

$ lncli listunspent
{
    "utxos": []
}

$ lncli listunspent
{
    "utxos": []
}

$ lncli getinfo|grep sync
    "synced_to_chain": true,
    "synced_to_graph": true,

I did the command lncli newaddress p2wkh and got a bitcoin address that shows my first transactions.

My public key is completely consistent with my old node. From this I conclude that the seed and cipher seed phrase are correct.

Perlover commented 1 week ago

I have now decided to try running lnd with the --reset-wallet-transactions option. I don't know if this will help yet. But in any case it all looks like some kind of bug.

Perlover commented 6 days ago

After rescanning the entire wallet again, there are some small changes. Namely:

1) lncli walletbalance - the balance is still zero. Although I'm sure there must be unspent UTXOs in the non-channels. 2) lncli listunspent - empty array 3) lncli listchaintxns - shows only two transactions. One is replenishment of the address I created for checking (I described it in the first post - lncli newaddress p2wkh), the second transaction is spending from that address.

By all my feelings, everything works like this: after the recovery procedure, LND for some reason did not generate a list of addresses from seed for checking and scanning balances on them and scanned incomprehensible addresses during recovery.

The second time when I created a new address (to see first message: "I did the command lncli newaddress p2wkh and got a bitcoin address that shows my first transactions."), which was replenished 2 years ago, and the subsequent scanning - LND checked and found transactions on it. But only at that address.

All other addresses still "do not exist" for it.

Accordingly, I can't even start the recovery procedure from SCB yet.

Perlover commented 5 days ago

I solved my problem only by downgrading the LND server to 0.17.5 (with a complete cleanup of the entire LND directory). The bitcoin backend remained the same - bitcoind v27.1.

As a result, the recovery of funds went smoothly and without problems.

I can conclude that version 0.18.0 has a bug that prevents the funds recovery procedure. Moreover, version 0.18.0 simply does not allow to restore funds from the wallet...

ziggie1984 commented 4 days ago

Thank you for this detailed description of the problem, I will test the recovery procedure on regtest via 0.18 and get back to you.