Skip to content

Commit d3c1d53

Browse files
feat(wallet): initial transactions fetch window reduced to 1 week down from 1 month
1 parent fe629c7 commit d3c1d53

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/wallet/src/services/TransactionsTracker.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ import { newAndStoredMulticast } from './util/newAndStoredMulticast';
4040
import chunk from 'lodash/chunk.js';
4141
import sortBy from 'lodash/sortBy.js';
4242

43-
const ONE_MONTH_BLOCK_TIME = 21_600 * 6;
43+
const DAYS_IN_EPOCH = 5;
44+
const BLOCKS_PER_EPOCH = 21_600;
45+
const BLOCKS_PER_DAY = BLOCKS_PER_EPOCH / DAYS_IN_EPOCH;
46+
const BLOCKS_PER_WEEK = BLOCKS_PER_DAY * 7;
4447

4548
export interface TransactionsTrackerProps {
4649
chainHistoryProvider: ChainHistoryProvider;
@@ -232,7 +235,7 @@ const fetchInitialTransactions = async (
232235
}
233236

234237
const highBlockNo = Cardano.BlockNo(Math.max(...firstPassTxs.map((tx) => tx.blockHeader.blockNo)));
235-
const onMonthBack = Cardano.BlockNo(Math.max(highBlockNo - ONE_MONTH_BLOCK_TIME, 0));
238+
const onMonthBack = Cardano.BlockNo(Math.max(highBlockNo - BLOCKS_PER_WEEK, 0));
236239

237240
return await allTransactionsByAddresses(chainHistoryProvider, {
238241
addresses,

0 commit comments

Comments
 (0)