From 47426d838e408849ca520102cffbcae8090944d9 Mon Sep 17 00:00:00 2001 From: Paul V Puey Date: Wed, 25 Feb 2026 07:24:07 -0800 Subject: [PATCH 1/3] Remove stale onSubscribeAddresses from test callbacks The onSubscribeAddresses property was removed from EdgeCurrencyEngineCallbacks but remained in the test mock, causing a TypeScript compilation error. --- test/engine/engine.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/test/engine/engine.ts b/test/engine/engine.ts index 922ec8f..3bd683c 100644 --- a/test/engine/engine.ts +++ b/test/engine/engine.ts @@ -73,7 +73,6 @@ for (const fixture of fixtures) { }, onUnactivatedTokenIdsChanged() {}, onStakingStatusChanged() {}, - onSubscribeAddresses() {}, onWcNewContractCall(payload) { emitter.emit('wcNewContractCall', payload) }, From cb39e6ab89cca35f9848e672fe2ba8692b4294e8 Mon Sep 17 00:00:00 2001 From: Paul V Puey Date: Wed, 25 Feb 2026 07:24:29 -0800 Subject: [PATCH 2/3] Gate Monero empty transaction callbacks MoneroEngine called onTransactions unconditionally, generating ~70 Redux dispatches and bridge messages per 10 seconds for nothing. Now gates the call on a non-empty array. --- src/MoneroEngine.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/MoneroEngine.ts b/src/MoneroEngine.ts index 6027316..8bb6b7f 100644 --- a/src/MoneroEngine.ts +++ b/src/MoneroEngine.ts @@ -304,8 +304,10 @@ export class MoneroEngine implements EdgeCurrencyEngine { } this.saveTransactionState(PRIMARY_CURRENCY_TOKEN_ID, edgeTransaction) - this.edgeTxLibCallbacks.onTransactions(this.transactionEventArray) - this.transactionEventArray = [] + if (this.transactionEventArray.length > 0) { + this.edgeTxLibCallbacks.onTransactions(this.transactionEventArray) + this.transactionEventArray = [] + } return blockHeight } @@ -457,10 +459,8 @@ export class MoneroEngine implements EdgeCurrencyEngine { doInitialCallbacks(): void { for (const tokenId of this.walletLocalData.enabledTokens) { try { - this.edgeTxLibCallbacks.onTokenBalanceChanged( - tokenId, - this.walletLocalData.totalBalances.get(tokenId) ?? '0' - ) + const _bal = this.walletLocalData.totalBalances.get(tokenId) ?? '0' + this.edgeTxLibCallbacks.onTokenBalanceChanged(tokenId, _bal) } catch (e) { this.log.error('Error for currencyCode', tokenId, e) } From f6ffd9a42ef681e2e948202222f4ff65adfa4efd Mon Sep 17 00:00:00 2001 From: Paul V Puey Date: Wed, 25 Feb 2026 07:24:53 -0800 Subject: [PATCH 3/3] Gate Monero onSeenTxCheckpoint to only fire on advancement Monero fired onSeenTxCheckpoint 5-6 times per 10 seconds with identical checkpoint values. Comparing the new checkpoint to the previous before calling eliminates redundant emissions. Also throttles onAddressesChecked to a maximum of one emission per 500ms (ratio=1 always passes through) to cap aggregate sync-status volume. --- src/MoneroEngine.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/MoneroEngine.ts b/src/MoneroEngine.ts index 8bb6b7f..ca835e9 100644 --- a/src/MoneroEngine.ts +++ b/src/MoneroEngine.ts @@ -66,6 +66,9 @@ const SAVE_DATASTORE_MILLISECONDS = 10000 const PRIMARY_CURRENCY_TOKEN_ID = null +// Global throttle: max 1 onAddressesChecked per 500ms; ratio=1 always passes. +let lastSyncEmitTime = 0 + export class MoneroEngine implements EdgeCurrencyEngine { apiKey: string walletInfo: SafeWalletInfo @@ -169,6 +172,9 @@ export class MoneroEngine implements EdgeCurrencyEngine { return } if (numTx !== totalTxs) { + const now = Date.now() + if (now - lastSyncEmitTime < 500) return + lastSyncEmitTime = now const progress = numTx / totalTxs this.edgeTxLibCallbacks.onAddressesChecked(progress) } else { @@ -345,11 +351,13 @@ export class MoneroEngine implements EdgeCurrencyEngine { } this.updateOnAddressesChecked(transactions.length, transactions.length) - // Update the seenTxCheckpoint state: - this.seenTxCheckpoint = seenTxCheckpoint - this.edgeTxLibCallbacks.onSeenTxCheckpoint( - wasSeenTxCheckpoint(this.seenTxCheckpoint) - ) + // Only update the seenTxCheckpoint if it actually advanced: + const newCheckpoint = wasSeenTxCheckpoint(seenTxCheckpoint) + const oldCheckpoint = wasSeenTxCheckpoint(this.seenTxCheckpoint) + if (newCheckpoint !== oldCheckpoint) { + this.seenTxCheckpoint = seenTxCheckpoint + this.edgeTxLibCallbacks.onSeenTxCheckpoint(newCheckpoint) + } } catch (e) { this.log.error('checkTransactionsInnerLoop', e) }