ACINQ / eclair

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

Android client doesn't detect payment until it has a confirmation #190

Closed fresheneesz closed 6 years ago

fresheneesz commented 6 years ago

Mempool transactions should be detectable right?

sstone commented 6 years ago

Could you please be a bit more specific (do you mean payments made in eclair-wallet to a bitcoin address, or payments sent to eclair-wallet's bitcoin address) ?

Eclair-wallet does detect 0-conf payments, but it may be possible that it is not synchronized yet and needs to catch up with the bitcoin network (this should be very quick, a few minutes at the most, and only when it is started for the first time or has been offline for a long time).

fresheneesz commented 6 years ago

I'm talking about payments made to my éclair address. It was when i first downloaded the app, so maybe it wasn't synced. Would it be possible to set up whatever process watches the newest transactions while older blocks are syncing?

As an aside, why do old blocks even need to catch up to the network in any way. If the address was just created, there's nothing to catch up with right?

sstone commented 6 years ago

Wallets cannot tell that a tx is valid if they're not synchronized yet (it could be spending an input that it does not have yet, or that it has but is spent by another tx in a block it has not received yet).

You could also be restoring a wallet with a seed that has been used elsewhere, or using the same seed on 2 different machines, so "new" addresses could in fact already have been used.

Once eclair-wallet is synced it will display 0-conf tx htat it has received.

fresheneesz commented 6 years ago

Wallets cannot tell that a tx is valid if they're not synchronized yet

@sstone Sounds kind of like you're saying that Eclair is downloading the entire blockchain.. but I know that isn't the case. Why would the client need to have anything downloaded in order to recognize new transactions coming in? Surely even after whatever sync process the eclair client goes through, it still has to ask a full node to tell it when a transaction has come in for it. Why doesn't it make that subscription before it starts syncing instead of after? Perhaps I'm not fully understanding how Eclair works.

You could also be restoring a wallet

But you usually aren't, and the client has full knowledge of whether that's the case or not.

sstone commented 6 years ago

This is not specific to eclair but to how wallets work. we use an SPV wallet (based on bitcoinj) which does not download the entire blockchain, only headers and relevant transactions (using a "subscription" based on bloom filters which is indeed set up before the wallet starts syncing). It still needs to be synced before it can be used (this is fast when the wallet starts from scratch, and becomes very fast from then on unless you've been offline for a very long time). AFAICT all wallets (full nodes, variations on SPV, ...) behave like this, because that's basically how the blockchain works (each new block changes the utxo set, a wallet's job is to keep track of the ones you can spend).

fresheneesz commented 6 years ago

@sstone Why not download the block headers and relevant in reverse order? Wouldn't that be the most appropriate thing to do, especially for a newly generated wallet? That's possible via SPV right?

sstone commented 6 years ago

@fresheneesz This is an issue tracker for eclair, and we would very much like to restrict it to technical issues. For general questions please checkout our gitter (https://gitter.im/ACINQ/eclair), and for general questions about bitcoin or lightning there are several ML and IRC channels where you can post (bitcoin-dev, lightning-dev, ...). There are not that many technical ressources about wallet design but I suggest you take a look at https://bitcoinj.github.io Thanks

pm47 commented 6 years ago

Couldn't reproduce.