From 2f4a2960a60a41b0ac51437dbf41c7c1046e9a14 Mon Sep 17 00:00:00 2001 From: Ana G <40721795+Bitcoinera@users.noreply.github.com> Date: Thu, 20 Feb 2020 19:50:09 +0100 Subject: [PATCH] fix my mess once more (#353) --- lib/reducers/cosmosV0-reducers.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/reducers/cosmosV0-reducers.js b/lib/reducers/cosmosV0-reducers.js index 0ac07c72f2..fecc854b49 100644 --- a/lib/reducers/cosmosV0-reducers.js +++ b/lib/reducers/cosmosV0-reducers.js @@ -401,18 +401,18 @@ function formatTransactionsReducer(txs, reducers) { const sortedTxs = sortBy(duplicateFreeTxs, ['timestamp']) const reversedTxs = reverse(sortedTxs) // here we filter out all transactions related to validators - let filteredTxs = [] + let filteredMsgs = [] reversedTxs.forEach(transaction => { - const index = transaction.tx.value.msg.findIndex(msg => - cosmosWhitelistedMessageTypes.has(msg.type.split('/')[1]) - ) - // only push transactions messages supported by Lunie - if (index !== -1) { - transaction.tx.value.msg = [transaction.tx.value.msg[index]] - filteredTxs.push(transaction) - } + transaction.tx.value.msg.forEach(msg => { + // only push transactions messages supported by Lunie + if (cosmosWhitelistedMessageTypes.has(msg.type.split('/')[1])) { + filteredMsgs.push(msg) + } + }) + transaction.tx.value.msg = filteredMsgs + filteredMsgs = [] }) - return filteredTxs.map(tx => transactionReducer(tx, reducers)) + return reversedTxs.map(tx => transactionReducer(tx, reducers)) } function transactionReducerV2(transaction, reducers) {