Skip to content

Refuse to startup on network switching #117

Closed

Description

@tnull

Currently we don't detect and properly handle if the users restarts the node with a different network.

As this might result in undefined behavior, we should detect a network switch and refuse to start up for the time being.

Activity

  1. tnull commented on Oct 3, 2023

    @tnull
    CollaboratorAuthor

    Sames goes for seed switching.

  2. elnosh commented on Mar 15, 2025

    @elnosh
    Contributor

    I was taking a look at this and although not explicitly by NodeBuilder, I noticed this check is kind of already happening here:

    ldk-node/src/builder.rs

    Lines 896 to 905 in 22cb1df

    let wallet_opt = BdkWallet::load()
    .descriptor(KeychainKind::External, Some(descriptor.clone()))
    .descriptor(KeychainKind::Internal, Some(change_descriptor.clone()))
    .extract_keys()
    .check_network(config.network)
    .load_wallet(&mut wallet_persister)
    .map_err(|e| {
    log_error!(logger, "Failed to set up wallet: {}", e);
    BuildError::WalletSetupFailed
    })?;
    when trying to load the BDK wallet. I tried it out and it does fail at this point if the node is restarted with a different network. Should we still add the check on the LDK-Node side to not depend on this check from the BDK wallet? if so, I can try it (:

  3. tnull commented on Mar 17, 2025

    @tnull
    CollaboratorAuthor

    I tried it out and it does fail at this point if the node is restarted with a different network.

    Yes, we fail at this point and would also later when we try to intialize ChannelManager or monitors with a changed network. While the behavior changed a bit over time since this issue was created, it's now mostly about clearly communicating what happened to the user.

    Should we still add the check on the LDK-Node side to not depend on this check from the BDK wallet? if so, I can try it (:

    Sure, I guess by now it would be mostly to create a new more conclusive error type that gets returned for the respective variants of BDK's LoadError that indicate network switiching.

  4. tnull commented on Mar 25, 2025

    @tnull
    CollaboratorAuthor

    Closed by #485

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions