mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-03 12:06:21 +01:00
FIX: speedup onchain wallet creation (dont pre-fill too much cache)
This commit is contained in:
parent
899cabab8f
commit
497e38eda4
3 changed files with 6 additions and 5 deletions
|
@ -404,10 +404,10 @@ export class AbstractHDElectrumWallet extends AbstractHDWallet {
|
|||
// its faster to pre-build hashmap of owned addresses than to query `this.weOwnAddress()`, which in turn
|
||||
// iterates over all addresses in hierarchy
|
||||
const ownedAddressesHashmap = {};
|
||||
for (let c = 0; c < this.next_free_address_index + this.gap_limit; c++) {
|
||||
for (let c = 0; c < this.next_free_address_index + 1; c++) {
|
||||
ownedAddressesHashmap[this._getExternalAddressByIndex(c)] = true;
|
||||
}
|
||||
for (let c = 0; c < this.next_free_change_address_index + this.gap_limit; c++) {
|
||||
for (let c = 0; c < this.next_free_change_address_index + 1; c++) {
|
||||
ownedAddressesHashmap[this._getInternalAddressByIndex(c)] = true;
|
||||
}
|
||||
// hack: in case this code is called from LegacyWallet:
|
||||
|
|
|
@ -205,7 +205,7 @@ const WalletsAdd = () => {
|
|||
}
|
||||
BlueApp.wallets.push(w);
|
||||
await BlueApp.saveToDisk();
|
||||
EV(EV.enum.WALLETS_COUNT_CHANGED);
|
||||
setTimeout(() => EV(EV.enum.WALLETS_COUNT_CHANGED), 500); // heavy task; hopefully will be executed while user is staring at backup screen
|
||||
A(A.ENUM.CREATED_WALLET);
|
||||
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
|
||||
if (w.type === HDSegwitP2SHWallet.type || w.type === HDSegwitBech32Wallet.type) {
|
||||
|
|
|
@ -140,6 +140,7 @@ export default class WalletsList extends Component {
|
|||
}
|
||||
|
||||
const wallets = BlueApp.getWallets().concat(false);
|
||||
const dataSource = BlueApp.getTransactions(null, 10);
|
||||
if (scrollToEnd) {
|
||||
scrollToEnd = wallets.length > this.state.wallets.length;
|
||||
}
|
||||
|
@ -148,8 +149,8 @@ export default class WalletsList extends Component {
|
|||
{
|
||||
isLoading: false,
|
||||
isFlatListRefreshControlHidden: true,
|
||||
dataSource: BlueApp.getTransactions(null, 10),
|
||||
wallets: BlueApp.getWallets().concat(false),
|
||||
dataSource,
|
||||
wallets,
|
||||
},
|
||||
() => {
|
||||
if (scrollToEnd) {
|
||||
|
|
Loading…
Add table
Reference in a new issue