Skip to content

WatchedOutput::block_hash is not persistent across restarts #2119

Open

Description

@tnull

In WatchedOutput::block_hash we return the "[f]irst block where the transaction output may have been spent."

However, we only set this Some when we initially process the parent transaction:

block_hash: Some(block_hash),
but not when re-registering after a restart:

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:

Activity

  1. wpaulino commented on Mar 21, 2023

    @wpaulino
    Contributor

    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.

  2. added this to the 0.0.124 milestone on May 5, 2024
  3. removed this from the 0.0.124 milestone on May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions