Skip to content

Commit 219e546

Browse files
authored
Merge pull request #1567 from input-output-hk/chore/do-not-trigger-refetches-on-same-tip
chore(wallet): refetch only if tip has changed
2 parents 5e7a5da + 977e8bc commit 219e546

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/wallet/src/Wallets/BaseWallet.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ import { RetryBackoffConfig } from 'backoff-rxjs';
112112
import { Shutdown, contextLogger, deepEquals } from '@cardano-sdk/util';
113113
import { WalletStores, createInMemoryWalletStores } from '../persistence';
114114
import { getScriptAddress } from './internals';
115+
import { onlyDistinctBlockRefetch } from '../services/DrepInfoTracker';
115116
import isEqual from 'lodash/isEqual.js';
116117
import uniq from 'lodash/uniq.js';
117118

@@ -521,7 +522,7 @@ export class BaseWallet implements ObservableWallet {
521522
knownAddresses$: this.addresses$,
522523
logger: contextLogger(this.#logger, 'delegation'),
523524
protocolParameters$: this.protocolParameters$,
524-
refetchRewardAccountInfo$: this.#refetchRewardAccountInfo$,
525+
refetchRewardAccountInfo$: onlyDistinctBlockRefetch(this.#refetchRewardAccountInfo$, this.tip$),
525526
retryBackoffConfig,
526527
rewardAccountAddresses$: this.addresses$.pipe(
527528
map((addresses) => uniq(addresses.map((groupedAddress) => groupedAddress.rewardAccount)))

0 commit comments

Comments
 (0)