lnd icon indicating copy to clipboard operation
lnd copied to clipboard

[bug]: Remote Signer: ImportAccount: incorrect coin type in derivation path on testnet

Open kaloudis opened this issue 1 year ago • 2 comments
trafficstars

Background

Discovered originally in https://github.com/lightningnetwork/lnd/issues/8626. When importing a testnet account the coin type in the derivation path is incorrect, indicating mainnet.

ie. derivation path is incorrectly set to m/84'/0'/'0' instead of m/84'/1'/'0'.

This causes external signers to throw errors when attempting to sign PSBTs generated with FundPsbt.

I suspect the issue persists with signet accounts too.

Your environment

  • lnd v0.17.4-beta
  • Coldcard Q1, SeedSigner hardware devices

Steps to reproduce

Import xpub (tpub/vpub) from external witness pubkey hash testnet account using the ImportAccount endpoint.

Expected behaviour

Derivation should be set to m/84'/1'/'0'.

Actual behaviour

Derivation path is incorrectly set to m/84'/0'/'0'.

kaloudis avatar Apr 13 '24 05:04 kaloudis

This likely needs to be fixed in btcwallet, but I guess there's also some change in lnd needed.

guggero avatar Apr 15 '24 06:04 guggero

This likely needs to be fixed in btcwallet, but I guess there's also some change in lnd needed.

I believe you're correct. I write some cursory tests in btcwallet using testnet tpubs and the coin type was getting set correctly.

kaloudis avatar Apr 15 '24 15:04 kaloudis