Skip to content

Commit

Permalink
fix: show correct UI count for BTC addresses being pulled, ref #4983
Browse files Browse the repository at this point in the history
  • Loading branch information
pete-watters committed May 15, 2024
1 parent e288d41 commit 9f73b24
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ function LedgerRequestBitcoinKeys() {
const { keys } = await pullBitcoinKeysFromLedgerDevice(app)({
network: bitcoinNetworkModeToCoreNetworkMode(network.chain.bitcoin.bitcoinNetwork),
onRequestKey(index) {
if (index <= 4) {
const keyGroupFinalIndex = defaultNumberOfKeysToPullFromLedgerDevice - 1;
const isNativeSegwitkey = index <= keyGroupFinalIndex;
if (isNativeSegwitkey) {
ledgerNavigate.toDeviceBusyStep(
`Requesting Bitcoin Native Segwit address (${index + 1}${defaultNumberOfKeysToPullFromLedgerDevice})`
);
return;
}
ledgerNavigate.toDeviceBusyStep(
`Requesting Bitcoin Taproot address (${index - 4}${defaultNumberOfKeysToPullFromLedgerDevice})`
`Requesting Bitcoin Taproot address (${index - keyGroupFinalIndex}${defaultNumberOfKeysToPullFromLedgerDevice})`
);
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ export function pullBitcoinKeysFromLedgerDevice(bitcoinApp: BitcoinApp, targetId
});
keys.push({ id: createWalletIdDecoratedPath(path, 'default'), path, policy, targetId });
}

for (
let accountIndex = 0;
accountIndex < defaultNumberOfKeysToPullFromLedgerDevice;
accountIndex++
) {
onRequestKey?.(accountIndex + 5);
onRequestKey?.(accountIndex + defaultNumberOfKeysToPullFromLedgerDevice);
const { path, policy } = await getTaprootExtendedPublicKey({
bitcoinApp,
fingerprint,
Expand Down

0 comments on commit 9f73b24

Please sign in to comment.