mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-29 22:16:05 +00:00
Fixes for randomize addresses for electrum wallets
This commit is contained in:
parent
d6b9753ffa
commit
3b70cc91fe
1 changed files with 10 additions and 1 deletions
|
@ -132,7 +132,16 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store {
|
|||
}
|
||||
|
||||
void randomizeAddress() {
|
||||
const minCountOfVisibleAddresses = 5;
|
||||
final random = Random();
|
||||
address = addresses[random.nextInt(addresses.length)].address;
|
||||
var availableAddresses = addresses
|
||||
.where((addr) => !addr.isHidden)
|
||||
.toList();
|
||||
|
||||
if (availableAddresses.length < minCountOfVisibleAddresses) {
|
||||
availableAddresses = addresses;
|
||||
}
|
||||
|
||||
address = availableAddresses[random.nextInt(availableAddresses.length)].address;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue