From ccd7e625782603bfb8f8c8d31c62b152d59094c1 Mon Sep 17 00:00:00 2001 From: Dan Miller Date: Tue, 26 Nov 2019 13:50:13 -0330 Subject: [PATCH] Handle transaction ordering in cases where tx ids are off by more than 1 in tx-state-manager --- app/scripts/controllers/transactions/tx-state-manager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/scripts/controllers/transactions/tx-state-manager.js b/app/scripts/controllers/transactions/tx-state-manager.js index 7b5ee21bfe15..8282d665bdbe 100644 --- a/app/scripts/controllers/transactions/tx-state-manager.js +++ b/app/scripts/controllers/transactions/tx-state-manager.js @@ -167,9 +167,9 @@ class TransactionStateManager extends EventEmitter { transactions.splice(index, 1) } } - const newTxIndex = transactions.findIndex((metaTx) => { - return metaTx.id === txMeta.id + 1 - }) + const newTxIndex = transactions + .findIndex((currentTxMeta) => currentTxMeta.id > txMeta.id) + newTxIndex === -1 ? transactions.push(txMeta) : transactions.splice(newTxIndex, 0, txMeta)