mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-03 20:07:11 +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
|
// its faster to pre-build hashmap of owned addresses than to query `this.weOwnAddress()`, which in turn
|
||||||
// iterates over all addresses in hierarchy
|
// iterates over all addresses in hierarchy
|
||||||
const ownedAddressesHashmap = {};
|
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;
|
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;
|
ownedAddressesHashmap[this._getInternalAddressByIndex(c)] = true;
|
||||||
}
|
}
|
||||||
// hack: in case this code is called from LegacyWallet:
|
// hack: in case this code is called from LegacyWallet:
|
||||||
|
|
|
@ -205,7 +205,7 @@ const WalletsAdd = () => {
|
||||||
}
|
}
|
||||||
BlueApp.wallets.push(w);
|
BlueApp.wallets.push(w);
|
||||||
await BlueApp.saveToDisk();
|
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);
|
A(A.ENUM.CREATED_WALLET);
|
||||||
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
|
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
|
||||||
if (w.type === HDSegwitP2SHWallet.type || w.type === HDSegwitBech32Wallet.type) {
|
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 wallets = BlueApp.getWallets().concat(false);
|
||||||
|
const dataSource = BlueApp.getTransactions(null, 10);
|
||||||
if (scrollToEnd) {
|
if (scrollToEnd) {
|
||||||
scrollToEnd = wallets.length > this.state.wallets.length;
|
scrollToEnd = wallets.length > this.state.wallets.length;
|
||||||
}
|
}
|
||||||
|
@ -148,8 +149,8 @@ export default class WalletsList extends Component {
|
||||||
{
|
{
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
isFlatListRefreshControlHidden: true,
|
isFlatListRefreshControlHidden: true,
|
||||||
dataSource: BlueApp.getTransactions(null, 10),
|
dataSource,
|
||||||
wallets: BlueApp.getWallets().concat(false),
|
wallets,
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
if (scrollToEnd) {
|
if (scrollToEnd) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue