From 940de3e4830bd25c4ab81a34d43d2b7e2f41009d Mon Sep 17 00:00:00 2001 From: jeffsmale90 <6363749+jeffsmale90@users.noreply.github.com> Date: Tue, 7 Feb 2023 10:01:16 +1300 Subject: [PATCH] Only load transactions, blocks, and events from after the fork block (#5221) --- src/integrations/ethereum/common/redux/blocks/actions.js | 7 ++++++- src/integrations/ethereum/common/redux/events/actions.js | 8 +++++++- .../ethereum/common/redux/transactions/actions.js | 7 ++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/integrations/ethereum/common/redux/blocks/actions.js b/src/integrations/ethereum/common/redux/blocks/actions.js index 1b3919356..0d927ffa9 100644 --- a/src/integrations/ethereum/common/redux/blocks/actions.js +++ b/src/integrations/ethereum/common/redux/blocks/actions.js @@ -13,11 +13,16 @@ export const clearBlocksInView = function() { }; export const requestPage = function(startBlockNumber, endBlockNumber) { - endBlockNumber = endBlockNumber || 0; return function(dispatch, getState) { if (startBlockNumber == null) { startBlockNumber = getState().core.latestBlock; } + if (endBlockNumber == null) { + const state = getState(); + endBlockNumber = state.config.settings.workspace.server.fork + ? state.config.settings.workspace.server.fork_block_number + 1 + : 0; + } let earliestBlockToRequest = Math.max( startBlockNumber - PAGE_SIZE, diff --git a/src/integrations/ethereum/common/redux/events/actions.js b/src/integrations/ethereum/common/redux/events/actions.js index 3287889a1..d49338c1a 100644 --- a/src/integrations/ethereum/common/redux/events/actions.js +++ b/src/integrations/ethereum/common/redux/events/actions.js @@ -19,11 +19,17 @@ export const setSubscribedTopics = function(topics) { export const SET_LOADING = `${prefix}/SET_LOADING`; export const requestPage = function(startBlockNumber, endBlockNumber) { - endBlockNumber = endBlockNumber || 0; return async function(dispatch, getState) { if (startBlockNumber == null) { startBlockNumber = getState().core.latestBlock; } + if (endBlockNumber == null) { + const state = getState(); + endBlockNumber = state.config.settings.workspace.server.fork + ? state.config.settings.workspace.server.fork_block_number + 1 + : 0; + } + let earliestBlockToRequest = Math.max( startBlockNumber - PAGE_SIZE, diff --git a/src/integrations/ethereum/common/redux/transactions/actions.js b/src/integrations/ethereum/common/redux/transactions/actions.js index f1bcce4da..41bb02640 100644 --- a/src/integrations/ethereum/common/redux/transactions/actions.js +++ b/src/integrations/ethereum/common/redux/transactions/actions.js @@ -17,11 +17,16 @@ export const clearTransactionsInView = function() { export const SET_LOADING = `${prefix}/SET_LOADING`; export const requestPage = function(startBlockNumber, endBlockNumber) { - endBlockNumber = endBlockNumber || 0; return function(dispatch, getState) { if (startBlockNumber == null) { startBlockNumber = getState().core.latestBlock; } + if (endBlockNumber == null) { + const state = getState(); + endBlockNumber = state.config.settings.workspace.server.fork + ? state.config.settings.workspace.server.fork_block_number + 1 + : 0; + } let earliestBlockRequested = Math.max( startBlockNumber - PAGE_SIZE,