@@ -261,12 +261,8 @@ export class MoneroEngine implements EdgeCurrencyEngine {
261261 ourReceiveAddresses . push ( this . walletInfo . keys . moneroAddress . toLowerCase ( ) )
262262 }
263263
264- let blockHeight = tx . height
265- if ( tx . mempool ) {
266- blockHeight = 0
267- }
268-
269- const date = Date . parse ( tx . timestamp ) / 1000
264+ const blockHeight = tx . height == null || tx . mempool ? 0 : tx . height
265+ const date = tx . timestamp == null ? new Date ( ) : new Date ( tx . timestamp )
270266
271267 // Expose legacy payment ID's to the GUI. This only applies
272268 // to really old transactions, before integrated addresses:
@@ -282,7 +278,7 @@ export class MoneroEngine implements EdgeCurrencyEngine {
282278 const edgeTransaction : EdgeTransaction = {
283279 blockHeight,
284280 currencyCode : 'XMR' ,
285- date,
281+ date : date . valueOf ( ) / 1000 ,
286282 isSend : lt ( netNativeAmount , '0' ) ,
287283 memos,
288284 nativeAmount : netNativeAmount ,
@@ -401,20 +397,20 @@ export class MoneroEngine implements EdgeCurrencyEngine {
401397 } )
402398 } else {
403399 const txs = this . getTxs ( tokenId )
404- const edgeTx = txs [ idx ]
400+ const oldTx = txs [ idx ]
401+
402+ // Keep the first-seen date for unconfirmed transactions:
403+ if ( edgeTransaction . blockHeight === 0 ) edgeTransaction . date = oldTx . date
405404
406405 // Already have this tx in the database. Consider a change if blockHeight changed
407- if ( edgeTx . blockHeight === edgeTransaction . blockHeight ) return
406+ if ( oldTx . blockHeight === edgeTransaction . blockHeight ) return
408407 this . log (
409408 `Update transaction: ${ edgeTransaction . txid } height:${ edgeTransaction . blockHeight } `
410409 )
411410
412411 // The native amounts returned from the API take some time before they're
413412 // accurate. We can trust the amounts we saved instead.
414- edgeTransaction = {
415- ...edgeTransaction ,
416- nativeAmount : edgeTx . nativeAmount
417- }
413+ edgeTransaction . nativeAmount = oldTx . nativeAmount
418414
419415 // Update the transaction
420416 txs [ idx ] = edgeTransaction
0 commit comments