diff --git a/lib/wallets/wallet/impl/firo_wallet.dart b/lib/wallets/wallet/impl/firo_wallet.dart index 230ba6c65..2ddbd50e8 100644 --- a/lib/wallets/wallet/impl/firo_wallet.dart +++ b/lib/wallets/wallet/impl/firo_wallet.dart @@ -1020,20 +1020,21 @@ class FiroWallet extends Bip39HDWallet ); } + bool isUsableOwner(Address? address) => + address != null && + address.value != collateralAddress && + address.value != payoutAddress; + Address? ownerAddress = await getCurrentReceivingAddress(); const maxOwnerAttempts = 32; - for ( - var i = 0; - i < maxOwnerAttempts && - (ownerAddress == null || ownerAddress.value == collateralAddress); - i++ - ) { + for (var i = 0; i < maxOwnerAttempts && !isUsableOwner(ownerAddress); i++) { await generateNewReceivingAddress(); ownerAddress = await getCurrentReceivingAddress(); } - if (ownerAddress == null || ownerAddress.value == collateralAddress) { + if (ownerAddress == null || !isUsableOwner(ownerAddress)) { throw Exception( - "Could not derive owner address distinct from collateral address.", + "Could not derive owner address distinct from collateral and payout " + "addresses.", ); }