@@ -227,45 +227,32 @@ export function makeCurrencyWalletCallbacks(
227227 id : walletId ,
228228 action : 'onBlockHeightChanged' ,
229229 updateFunc : ( ) => {
230- // Update transaction confirmation status
231- const { txs } = input . props . walletState
230+ // Notify GUI of transactions whose confirmations may have changed.
231+ const { txs, files } = input . props . walletState
232+ const changedTxs : EdgeTransaction [ ] = [ ]
232233 for ( const txid of Object . keys ( txs ) ) {
233234 const reduxTx = txs [ txid ]
234235 if ( shouldCoreDetermineConfirmations ( reduxTx . confirmations ) ) {
235- const { requiredConfirmations } =
236- input . props . walletState . currencyInfo
237- const { height } = input . props . walletState
238-
239- reduxTx . confirmations = determineConfirmations (
240- reduxTx ,
241- height ,
242- requiredConfirmations
243- )
244-
245- // Recreate the EdgeTransaction object
246236 const txidHash = hashStorageWalletFilename (
247237 input . props . state ,
248238 walletId ,
249239 reduxTx . txid
250240 )
251- const { files } = input . props . walletState
252241 const changedTx = combineTxWithFile (
253242 input ,
254243 reduxTx ,
255244 files [ txidHash ] ,
256- null
245+ null ,
246+ height
257247 )
258-
259- // Dispatch event to update the redux transaction object
260- input . props . dispatch ( {
261- type : 'CHANGE_MERGE_TX' ,
262- payload : { tx : reduxTx }
263- } )
264- // Dispatch event to update the EdgeTransaction object
265- throttledOnTxChanged ( [ changedTx ] )
248+ changedTxs . push ( changedTx )
266249 }
267250 }
251+ if ( changedTxs . length > 0 ) {
252+ throttledOnTxChanged ( changedTxs )
253+ }
268254
255+ // Update redux state for other consumers:
269256 input . props . dispatch ( {
270257 type : 'CURRENCY_ENGINE_CHANGED_HEIGHT' ,
271258 payload : { height, walletId }
@@ -380,18 +367,6 @@ export function makeCurrencyWalletCallbacks(
380367 const { isNew, transaction : tx } = txEvent
381368 const { txid } = tx
382369
383- // DEPRECATE: After all currency plugins implement new Confirmations API
384- if ( shouldCoreDetermineConfirmations ( tx . confirmations ) ) {
385- const { requiredConfirmations } = input . props . walletState . currencyInfo
386- const { height } = input . props . walletState
387-
388- tx . confirmations = determineConfirmations (
389- tx ,
390- height ,
391- requiredConfirmations
392- )
393- }
394-
395370 // Verify that something has changed:
396371 const reduxTx = mergeTx ( tx , reduxTxs [ txid ] )
397372 if ( compare ( reduxTx , reduxTxs [ txid ] ) && tx . metadata == null ) continue
@@ -492,7 +467,7 @@ export function watchCurrencyWallet(input: CurrencyWalletInput): void {
492467 *
493468 * @deprecated Remove once all currency plugins support the new confirmations API.
494469 */
495- const shouldCoreDetermineConfirmations = (
470+ export const shouldCoreDetermineConfirmations = (
496471 confirmations : EdgeConfirmationState | undefined
497472) : boolean => {
498473 return (
0 commit comments