From 7ddf21209181f902d2eb3f16d079ba46426127d8 Mon Sep 17 00:00:00 2001 From: julian Date: Wed, 8 Nov 2023 15:49:28 -0600 Subject: [PATCH] fix address generation index bug --- lib/wallets/wallet/intermediate/bip39_hd_wallet.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/wallets/wallet/intermediate/bip39_hd_wallet.dart b/lib/wallets/wallet/intermediate/bip39_hd_wallet.dart index a176f4d9e..eb01d996e 100644 --- a/lib/wallets/wallet/intermediate/bip39_hd_wallet.dart +++ b/lib/wallets/wallet/intermediate/bip39_hd_wallet.dart @@ -27,7 +27,7 @@ abstract class Bip39HDWallet extends Bip39Wallet @override Future generateNewReceivingAddress() async { final current = await getCurrentReceivingAddress(); - final index = current?.derivationIndex ?? 0; + final index = current == null ? 0 : current.derivationIndex + 1; const chain = 0; // receiving address final address = await _generateAddress( @@ -49,7 +49,7 @@ abstract class Bip39HDWallet extends Bip39Wallet @override Future generateNewChangeAddress() async { final current = await getCurrentChangeAddress(); - final index = current?.derivationIndex ?? 0; + final index = current == null ? 0 : current.derivationIndex + 1; const chain = 1; // change address final address = await _generateAddress(