Skip to content

Implement Fully Asynchronous Channel Opening  #182

@Roasbeef

Description

@Roasbeef

Currently, when opening a new channel, lnd must stay active during the entire duration of the funding process from initial message, to funding transaction confirmation. Ideally, this wouldn't be necessary and after the funding transaction has been broadcast, then remainder of the process be full asynchronous and able to survive restarts. Such a change would make lnd usable on platforms like laptops and mobile phones.

Two areas within the codebase need to be modified with some additional persistence (assuming retransmission has been implemented): the funding manager, and the authenticated gossiper. The lacking area of persistence within the fundingManager is whether or not we've sent the FundingLocked message and also the AnnouncmentSignature message after the channel has been confirmed. Within the AuthenticatedGossiper, the half of the AnnouncmentSignature received is currently stored in an in-memory map, this should be moved to persistent on-disk storage.

Steps To Completion

  • Once a channel has entered the final stage of funding a new on-disk state-machine for the channel should be created by the fundingManager. This state-machine will track the final stages of the funding workflow to ensure each step is reliable completed, even in the face of restarts.
  • Once the channel has been confirmed after the FundingLocked message has been sent, the on-disk state for the pending channel should be updated to mark that the FL message has been sent.
  • After the FL message has been sent, and the fundingManager constructs the necessary announcement signatures for the channel a special record should be created which tracks if teh channel has been announced on the network or not. Upon restart this record should be cross-checked with the available graph information from the database to ensure the advertised channel edge is present within the graph.
  • The AuthenticatedGossiper should be modified to persist the map that tracks half-proofs to disk s.t it survives restart. This is required as if the fundingManager send the proofs to the AG and a restart occurs, we won't be able to properly parse the remote peer's AnnouncmentSignature message and properly construct the valid ChannelAnnouncements.

NOTE: This depends on #156.

Metadata

Metadata

Assignees

No one assigned

    Labels

    databaseRelated to the database/storage of LNDfundingRelated to the opening of new channels with funding transactions on the blockchainintermediateIssues suitable for developers moderately familiar with the codebase and LNp2pCode related to the peer-to-peer behaviour

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions