lightningnetwork / lnd

Lightning Network Daemon ⚡️
MIT License
7.64k stars 2.08k forks source link

[bug]: Spend-Output monitoring might have a rare edge case where it misses the spend of an output. #8120

Open ziggie1984 opened 10 months ago

ziggie1984 commented 10 months ago

There are reported cases (#8028) where a noderunner had invalid values in his height hint cache leading to lnd not recognizing already spent outputs as spent. Using the config setting --height-hint-cache-query-disable in lnd, these situation were resolved. Maybe the historical recan logic has a race condition where it misses a spend somehow which eventually updates the height hint cache and therefore never recovering the monitored outputs because the height hint cache will be queried for any other historical rescan if we do not actively disable it.

I was not able to reproduce this issue so far.

Crypt-iQ commented 10 months ago

Did this happen in one of the cases where bitcoind's rpc serial version was set to the legacy witness encoding?

ziggie1984 commented 10 months ago

Yes the case I referenced had this setting on (rpcserialversion=0), but I am not sure how this could impact the monitoring because we are checking for outputs only ? Moreover after he set the --height-hint-cache-query-disable the historical rescan did work and lead to the situation where the preimage witness check happend (leading us to his problem of the rpcserialversion setting).