ACINQ / eclair

A scala implementation of the Lightning Network.
Apache License 2.0
1.24k stars 266 forks source link

Channels disappear after restarting Eclair #941

Closed yinzheng-zhong closed 5 years ago

yinzheng-zhong commented 5 years ago

I set up two channels today and everything looks fine. The funds have been successfully sent out from BTC wallet and channels are waiting for confirmation. Then I closed Eclair, after I restarted Eclair the channels showed 'closed' for 2 seconds then all of them disappeared. I haven't done anything between the funds went out and the channel disappears except restarting Eclair.

Using Eclair eclair-node-gui-0.3-SNAPSHOT-3eceb90 and bitcoin core 0.17.1

Given logs covering one of the transactions below (txid=a705704379d867639cc0710765df15f9a31cee21bd81fb775028943a875ead33): Before closing Eclair: '-----------------------------------------------------------------------------------------------------------------------------' before.txt '-----------------------------------------------------------------------------------------------------------------------------'

After restart Eclair:

'-----------------------------------------------------------------------------------------------------------------------------' after.txt '-----------------------------------------------------------------------------------------------------------------------------'

When I'm writing this the transactions already have 6+ confirmations on the blockchain however I can't find anything related to the txid or channel id on 1ML.

I know there are some similar issues but they don't seem to be the same. Is there any way I can get the channels back or the funds back? Thanks.

sstone commented 5 years ago

Hi. Unless the logs are really tiny (just a few lines), please do not paste them directly but use pastebin/zerobin etc...

This is the cause of your problem: Blockchain transactions are still in the process of being indexed. Use gettransaction for wallet transactions. (code: -5)

If your bitcoin node is not synced, or not indexed, then eclair's view of the blockchain will be just wrong. In this case Eclair thought that the funding tx did not exist, because your bitcoin node was not able to return information about it, and that it had been double-spent because it could also not find its inputs.

As long as you keep your data and logs we'll be able to get your funds back. But for now don't use eclair until your bitcoin node is fully synced.

yinzheng-zhong commented 5 years ago

@sstone Thank you for the replay. Sorry about the log. Actually, the BTC node was fully synced many days ago. When I was creating the channel the node was synced I'm sure of that. Blockchain transactions are still in the process of being indexed. Use gettransaction for wallet transactions. (code: -5) So the reason might be it's not indexed (does this mean the transaction hasn't yet been mined)?

It also says WARN f.a.eclair.router.Router - validation failure for shortChannelId=527338x224x0 reason=No such mempool transaction. This confused me at the beginning because I think as long as the fund has been sent out already, the transaction should be in the mempool. I guess this line of logs doesn't matter anymore?

I think what happened is that before the transaction got mined and put into blockchain I closed Eclair. After started Eclair again it can't figure out what happened If I'm right. I need to be careful next time.

Could you please let me how to get the fund back like send the sqlite and logs to you or something? Sorry, I'm a total noob here.

sstone commented 5 years ago

Your node was re-indexing its blocks. It can happen because

Eclair checks that your node is synced when it starts, so my guess would be a bitcoin node upgrade while eclair was already running ?

Your transaction was published and mined, but your node thought that it was not and worse that its inputs where gone too, which happens if it is double spent by your own wallet (i.e its inputs are reused for another transaction). Just Keep a copy of your eclair data directory and I'll get back to you asap.

yinzheng-zhong commented 5 years ago

OK thank you very much. I think I know what happened. Before I start Eclair again I restarted the system (docker actually) but without quitting BTC wallet properly. Then the wallet will do some verification and indexing but I started Eclair before it finished doing those. No problem I have the data backup. Cheers

sstone commented 5 years ago

Can you post your logs and db file (and nothing else) ? Thanks

yinzheng-zhong commented 5 years ago

mainnet.zip Is this one OK? logs also inside.

sstone commented 5 years ago

It's just an extract of the logs I'd like to have all of them if possible

sstone commented 5 years ago

Before I start Eclair again I restarted the system (docker actually) but without quitting BTC wallet properly

You probably need to also check your setup otherwise it's going to happen again. Your bitcoin node is not supposed to reindex its blocks everytime it starts: did you upgrade from an older version ? Or did you enable indexing ?

yinzheng-zhong commented 5 years ago

I know that now I'' double check next time don't worry. It re-index because I think I didn't close the wallet properly (I force shutdown the system). It works fine now. And if that happens again I won't start eclair before the wallet fully started. This is the log before I shut down the system: eclair.log This is the log after: eclair.2019-04-10.log Sorry for putting the wrong file in the .zip (was just confused).

yinzheng-zhong commented 5 years ago

Or maybe it's because I configured the docker when the docker was down? I can't remember but if the docker was edited the host will remove the docker image and reinstall it. Therefore, the BTC wallet was also reinstalled at that time so it goes to re-indexing. Anyway, I think I just need extra care next time.

t-bast commented 5 years ago

Closing this issue which seems to be resolved, feel free to re-open if you're still experiencing problems.