Skip to content
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

BTCPay Server wallet configs sometimes fail to migrate and leave app with an invalid wallet config in the database #1901

Closed
mrfelton opened this Issue Mar 26, 2019 · 0 comments

Comments

1 participant
@mrfelton
Copy link
Member

mrfelton commented Mar 26, 2019

Description

It seems that our migration script that updates the wallet config to our new format sometimes fails and leaves an invalid wallet config in the database. This can cause the app to hang when trying to connect to the wallet.

Expected Behavior

Remote wallet configs that can not be properly migrated should be removed completely.

Actual Behavior

App hangs on startup when trying to connect to the wallet. Logs show like:

image

Possible Fix

  1. Try to understand why migrating the btcpayserver config sometimes fails, and make changes to make it more reliable.

  2. Handle the failure case by deleting the wallet config completely.

      // Convert btcpayserver configs to lndconnect uri.
      else if (wallet.type === 'btcpayserver') {
        try {
          const { host, port, macaroon } = parseConnectionString(wallet.string)
          const lndconnectUri = encode({ host: `${host}:${port}`, macaroon })
          wallet.type = 'custom'
          wallet.decoder = 'lnd.lndconnect.v1'
          wallet.lndconnectUri = lndconnectUri
        } catch (e) {
          // There was a problem migrating this wallet config.
          // There isn't a way for us to recover from this so we do nothing and move on.
        }
      }

Context

3.x -> 4.0 migration

Your Environment

  • Zap version: 0.4.0
  • Operating System and version: All

@mrfelton mrfelton added this to the v0.4.1-beta milestone Mar 26, 2019

@mrfelton mrfelton self-assigned this Apr 2, 2019

mrfelton added a commit to mrfelton/zap-desktop that referenced this issue Apr 2, 2019

fix(migrate): delete invalid btcpayserver configs
When upgrading from 3.x to 4.x. delete btcpayserver configs if we are
unable to convert them to the new wallet config so that we don't end
up with invalid wallet configs in the database.

fix LN-Zap#1901

mrfelton added a commit to mrfelton/zap-desktop that referenced this issue Apr 2, 2019

fix(migrate): properly migrate btcpayserver configs
Fix issue with wallet config format conversion when upgrading from 3.x
to 4.x.

fix LN-Zap#1901
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.