Skip to content

config: fix bug in walletrpc interaction due to mismatched coin type#7588

Merged
guggero merged 1 commit intolightningnetwork:masterfrom
Roasbeef:simnet-walletrpc-cointype-fix
Apr 11, 2023
Merged

config: fix bug in walletrpc interaction due to mismatched coin type#7588
guggero merged 1 commit intolightningnetwork:masterfrom
Roasbeef:simnet-walletrpc-cointype-fix

Conversation

@Roasbeef
Copy link
Copy Markdown
Member

In this commit, we fix a bug that would cause the walletrpc on the simnet chain to not be able to respond to all RPC calls. The issue is that for the SimNet backend, within chainparams.go:

// BitcoinSimNetParams contains parameters specific to the simulation test
// network.
var BitcoinSimNetParams = BitcoinNetParams{
Params: &bitcoinCfg.SimNetParams,
RPCPort: "18556",
CoinType: keychain.CoinTypeTestnet,
}
, we set a new CoinType for Simnet in order to match the RegTest value.

Later on, when we go to verify the on disk accounts against the in-memory cointype, we fall through to an error case as the in-memory cointype is 115, while the on disk cointype is 1.

To fix this, when we know we're doing simnet mode, we'll override the cointype similar to the way we did/do for LTC.

Fixes #6807.

In this commit, we fix a bug that would cause the walletrpc on the
simnet chain to not be able to respond to all RPC calls. The issue is
that for the SimNet backend, within chainparams.go:
https://github.com/lightningnetwork/lnd/blob/6e0a67d05bd375c4b39db53dc45df74157227a57/chainreg/chainparams.go#L45-L51,
we set a new CoinType for Simnet in order to match the RegTest value.

Later on, when we go to verify the on disk accounts against the
in-memory cointype, we fall through to an error case as the in-memory
cointype is 115, while the on disk cointype is 1.

To fix this, when we know we're doing simnet mode, we'll override the
cointype similar to the way we did/do for LTC.

Fixes lightningnetwork#6807.
@Roasbeef Roasbeef added this to the v0.16.1 milestone Apr 10, 2023
@Roasbeef
Copy link
Copy Markdown
Member Author

Steps to test this:

  • Make an lnd node on simnet, can be any node.
  • Try to do lncli wallet accounts list -- that'all fail
  • Apply/upgrade to this patch, try again, should work

This wasn't caught in the itests as we use regtest (to have compat with a bitcoind nodes) everywhere.

Copy link
Copy Markdown
Collaborator

@sputn1ck sputn1ck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested your steps and got an error pre patch, with patch works as expected.

Copy link
Copy Markdown
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me 🎉

Copy link
Copy Markdown
Collaborator

@bitromortac bitromortac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, thank you 🍀!

@guggero guggero merged commit 5046399 into lightningnetwork:master Apr 11, 2023
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

Successfully merging this pull request may close these issues.

simnet: ListAccounts fails with unsupported key scope

4 participants