You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WatchedOutput::block_hash is not persistent across restarts #2119
I may be wrong, but as far as I can tell even re-confirming the registered transactions after restart might not lead to restore the block_hash value as we may omit processing them again in ChanneMonitor::transactions_confirmed/block_connected.
While probably not a big deal, it's strange either way to have this field not persisted during restarts (and potentially never filled in again). I see two potential ways to improve this:
Filling in the block hash value from Channel::funding_tx_confirmed_in in load_outputs_to_watch.
So the use of WatchedOutput::block_hash here is to rescan the exact block (not all blocks going forward from that point, as a typical rescan would) which is producing the additional register_output requests. If we restart before doing said rescan, we'd lose the context and miss notifying the additional outputs as spent if they were also spent in the same block. The tricky part though is that there's no way in the API to communicate that the rescan was done and didn't find anything, such that we can keep WatchedOutput::block_hash as None and just continue watching for the spend at tip.
Activity
wpaulino commentedon Mar 21, 2023
So the use of
WatchedOutput::block_hashhere is to rescan the exact block (not all blocks going forward from that point, as a typical rescan would) which is producing the additionalregister_outputrequests. If we restart before doing said rescan, we'd lose the context and miss notifying the additional outputs as spent if they were also spent in the same block. The tricky part though is that there's no way in the API to communicate that the rescan was done and didn't find anything, such that we can keepWatchedOutput::block_hashasNoneand just continue watching for the spend at tip.