Skip to content

Commit

Permalink
fixup! feat(wallet): the wallet now only fetches UTXOs on tx history …
Browse files Browse the repository at this point in the history
…change
  • Loading branch information
AngelCastilloB committed Nov 15, 2024
1 parent 721ebb6 commit d19d6a0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/wallet/src/services/TransactionsTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ const findIntersectionAndUpdateTxStore = ({

// Fetching transactions from scratch, nothing else to do here.
if (lowerBound === undefined) {
store.setAll(newTransactions);
return newTransactions;
}

Expand All @@ -213,11 +214,11 @@ const findIntersectionAndUpdateTxStore = ({

// The first segment of new transaction should match exactly (same txs and same order) our last know TXs. Otherwise
// roll them back and re-apply in new order.
const sameLength = localTxsFromSameBlock.length === firstSegmentOfNewTransactions.length;
const sameOrder =
sameLength && localTxsFromSameBlock.every((tx, index) => tx.id === firstSegmentOfNewTransactions[index].id);
const sameTxAndOrder = localTxsFromSameBlock.every(
(tx, index) => tx.id === firstSegmentOfNewTransactions[index].id
);

if (!sameLength || !sameOrder) {
if (!sameTxAndOrder) {
localTransactions = revertLastBlock(localTransactions, lowerBound, rollback$, newTransactions, logger);
localTransactions = [...localTransactions, ...newTransactions];
store.setAll(localTransactions);
Expand Down

0 comments on commit d19d6a0

Please sign in to comment.