Skip to content

Support during-sync operation #800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
TheBlueMatt opened this issue Feb 19, 2021 · 2 comments
Open

Support during-sync operation #800

TheBlueMatt opened this issue Feb 19, 2021 · 2 comments

Comments

@TheBlueMatt
Copy link
Collaborator

We should have a mode where a ChannelManager will only take "safe" actions which can occur while the chain is being synchronized in the background (ie we are guaranteed that we are behind the current tip, but will be in sync soon). When we do this we should also support syncing only to common tip(s) in the block-sync crate, see #791 (comment).

@ariard
Copy link

ariard commented Feb 19, 2021

I think the following actions can be labeld as "safe":

  • "read" : e.g list_channels, state might not be accurate but won't be change, so we can return data to the consumer flagging them as in-sync, so not 100% reliable
  • "gossips"-related: timer_chan_freshness_every_min,
  • balance-decreasing : sending payment N is safe, if any onchain commitment N-i has already been confirmed with different balances, the double-spend will be swallowed by our counterparty
  • channel opening : if we're initiator we might propose an opening with a no-more-available UTXO, worst-case scenario we broadcast an invalid funding transaction

Balance-increasing or closing are unsafe as a state less favorable to us might have been already committed onchain.

In theory we could make those "dangerous" operations valid if we lower our trust model by relying on some headers-verified at-tip assumevalid-UTXO, once those are available on the base layer. If you don't care about verifying gossips traffic and assuming you don't have channel close, you might bypass completely sync for mobile. The hard challenge is conserving privacy of your utxos towards semi-trusted assumevalid/BIP157 servers...

@TheBlueMatt
Copy link
Collaborator Author

Jeff notes in the above references in 808 that we should try to enforce this via an API refactor if possible, eg wrapping ChannelManager in a ChannelManagerSyncing object during deserialization and only allowing access to a subset of the API until the user informs us they're done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants