Skip to content

Commit

Permalink
feat_: disable tx history fetching for all accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
dlipicar committed Sep 2, 2024
1 parent e6a2f0a commit 970119a
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 34 deletions.
1 change: 0 additions & 1 deletion api/geth_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -1613,7 +1613,6 @@ func (b *GethStatusBackend) prepareSettings(request *requests.CreateAccount, inp
settings.TestNetworksEnabled = request.TestNetworksEnabled
if !input.restoringAccount {
settings.Mnemonic = &input.mnemonic
settings.OmitTransfersHistoryScan = true
// TODO(rasom): uncomment it as soon as address will be properly
// marked as shown on mobile client
//settings.MnemonicWasNotShown = true
Expand Down
23 changes: 23 additions & 0 deletions appdatabase/migrations/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE settings DROP COLUMN omit_transfers_history_scan;
1 change: 0 additions & 1 deletion mobile/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,6 @@ func SaveAccountAndLogin(accountData, password, settingsJSON, configJSON, subacc
}

if *settings.Mnemonic != "" {
settings.OmitTransfersHistoryScan = true
settings.MnemonicWasNotShown = true
}

Expand Down
5 changes: 0 additions & 5 deletions multiaccounts/settings/columns.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,11 +496,6 @@ var (
protobufType: protobuf.SyncSetting_URL_UNFURLING_MODE,
},
}
OmitTransfersHistoryScan = SettingField{
reactFieldName: "omit-transfers-history-scan",
dBColumnName: "omit_transfers_history_scan",
valueHandler: BoolHandler,
}
MnemonicWasNotShown = SettingField{
reactFieldName: "mnemonic-was-not-shown?",
dBColumnName: "mnemonic_was_not_shown",
Expand Down
7 changes: 2 additions & 5 deletions multiaccounts/settings/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ INSERT INTO settings (
profile_pictures_show_to,
profile_pictures_visibility,
url_unfurling_mode,
omit_transfers_history_scan,
mnemonic_was_not_shown,
wallet_token_preferences_group_by_community,
wallet_collectible_preferences_group_by_collection,
Expand All @@ -151,7 +150,7 @@ INSERT INTO settings (
fleet
) VALUES (
?,?,?,?,?,?,?,?,?,?,?,?,?,?,
?,?,?,?,?,?,?,?,?,'id',?,?,?,?,?,?,?,?,?,?,?)`,
?,?,?,?,?,?,?,?,?,'id',?,?,?,?,?,?,?,?,?,?)`,
s.Address,
s.Currency,
s.CurrentNetwork,
Expand Down Expand Up @@ -179,7 +178,6 @@ INSERT INTO settings (
s.ProfilePicturesShowTo,
s.ProfilePicturesVisibility,
s.URLUnfurlingMode,
s.OmitTransfersHistoryScan,
s.MnemonicWasNotShown,
s.TokenGroupByCommunity,
s.CollectibleGroupByCollection,
Expand Down Expand Up @@ -388,7 +386,7 @@ func (db *Database) GetSettings() (Settings, error) {
waku_bloom_filter_mode, webview_allow_permission_requests, current_user_status, send_status_updates, gif_recents,
gif_favorites, opensea_enabled, last_backup, backup_enabled, telemetry_server_url, auto_message_enabled, gif_api_key,
test_networks_enabled, mutual_contact_enabled, profile_migration_needed, is_goerli_enabled, wallet_token_preferences_group_by_community, url_unfurling_mode,
omit_transfers_history_scan, mnemonic_was_not_shown, wallet_show_community_asset_when_sending_tokens, wallet_display_assets_below_balance,
mnemonic_was_not_shown, wallet_show_community_asset_when_sending_tokens, wallet_display_assets_below_balance,
wallet_display_assets_below_balance_threshold, wallet_collectible_preferences_group_by_collection, wallet_collectible_preferences_group_by_community,
peer_syncing_enabled
FROM
Expand Down Expand Up @@ -467,7 +465,6 @@ func (db *Database) GetSettings() (Settings, error) {
&s.IsGoerliEnabled,
&s.TokenGroupByCommunity,
&s.URLUnfurlingMode,
&s.OmitTransfersHistoryScan,
&s.MnemonicWasNotShown,
&s.ShowCommunityAssetWhenSendingTokens,
&s.DisplayAssetsBelowBalance,
Expand Down
11 changes: 5 additions & 6 deletions multiaccounts/settings/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,11 @@ type Settings struct {
MessagesFromContactsOnly bool `json:"messages-from-contacts-only"`
Mnemonic *string `json:"mnemonic,omitempty"`
// NOTE(rasom): negation here because it safer/simpler to have false by default
MnemonicWasNotShown bool `json:"mnemonic-was-not-shown?,omitempty"`
MnemonicRemoved bool `json:"mnemonic-removed?,omitempty"`
OmitTransfersHistoryScan bool `json:"omit-transfers-history-scan?,omitempty"`
MutualContactEnabled bool `json:"mutual-contact-enabled?"`
Name string `json:"name,omitempty"`
Networks *json.RawMessage `json:"networks/networks"`
MnemonicWasNotShown bool `json:"mnemonic-was-not-shown?,omitempty"`
MnemonicRemoved bool `json:"mnemonic-removed?,omitempty"`
MutualContactEnabled bool `json:"mutual-contact-enabled?"`
Name string `json:"name,omitempty"`
Networks *json.RawMessage `json:"networks/networks"`
// NotificationsEnabled indicates whether local notifications should be enabled (android only)
NotificationsEnabled bool `json:"notifications-enabled?,omitempty"`
PhotoPath string `json:"photo-path"`
Expand Down
17 changes: 1 addition & 16 deletions services/wallet/transfer/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"
statusaccounts "github.com/status-im/status-go/multiaccounts/accounts"
"github.com/status-im/status-go/multiaccounts/settings"
"github.com/status-im/status-go/rpc"
"github.com/status-im/status-go/rpc/chain"
"github.com/status-im/status-go/services/accounts/accountsevent"
Expand Down Expand Up @@ -120,21 +119,7 @@ func (c *Controller) CheckRecentHistory(chainIDs []uint64, accounts []common.Add
return nil
}

omitHistory := false
multiaccSettings, err := c.accountsDB.GetSettings()
if err != nil {
log.Error("Failed to get multiacc settings") // not critical
} else {
omitHistory = multiaccSettings.OmitTransfersHistoryScan
}

if omitHistory {
err := c.accountsDB.SaveSettingField(settings.OmitTransfersHistoryScan, false)
if err != nil {
return err
}
}

const omitHistory = true
c.reactor = NewReactor(c.db, c.blockDAO, c.blockRangesSeqDAO, c.accountsDB, c.TransferFeed, c.transactionManager,
c.pendingTxManager, c.tokenManager, c.balanceCacher, omitHistory, c.blockChainState)

Expand Down

0 comments on commit 970119a

Please sign in to comment.