From ec84d70a496b545e490ce03458e005a03f8e42e5 Mon Sep 17 00:00:00 2001 From: ramil Date: Fri, 19 Feb 2021 23:10:06 +0300 Subject: [PATCH] fix unit test bug. Added sorting by tx index for transactions and receipts queries --- pkg/eth/ipld_retriever.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/eth/ipld_retriever.go b/pkg/eth/ipld_retriever.go index 3d81796a..52cb26ae 100644 --- a/pkg/eth/ipld_retriever.go +++ b/pkg/eth/ipld_retriever.go @@ -66,12 +66,14 @@ const ( FROM eth.transaction_cids INNER JOIN eth.header_cids ON (transaction_cids.header_id = header_cids.id) INNER JOIN public.blocks ON (transaction_cids.mh_key = blocks.key) - WHERE block_hash = $1` + WHERE block_hash = $1 + ORDER BY eth.transaction_cids.index ASC` RetrieveTransactionsByBlockNumberPgStr = `SELECT transaction_cids.cid, data FROM eth.transaction_cids INNER JOIN eth.header_cids ON (transaction_cids.header_id = header_cids.id) INNER JOIN public.blocks ON (transaction_cids.mh_key = blocks.key) - WHERE block_number = $1` + WHERE block_number = $1 + ORDER BY eth.transaction_cids.index ASC` RetrieveTransactionByHashPgStr = `SELECT cid, data FROM eth.transaction_cids INNER JOIN public.blocks ON (transaction_cids.mh_key = blocks.key) @@ -87,13 +89,14 @@ const ( INNER JOIN eth.header_cids ON (transaction_cids.header_id = header_cids.id) INNER JOIN public.blocks ON (receipt_cids.mh_key = blocks.key) WHERE block_hash = $1 - --ORDER BY eth.transaction_cids.index ASC` + ORDER BY eth.transaction_cids.index ASC` RetrieveReceiptsByBlockNumberPgStr = `SELECT receipt_cids.cid, data FROM eth.receipt_cids INNER JOIN eth.transaction_cids ON (receipt_cids.tx_id = transaction_cids.id) INNER JOIN eth.header_cids ON (transaction_cids.header_id = header_cids.id) INNER JOIN public.blocks ON (receipt_cids.mh_key = blocks.key) - WHERE block_number = $1` + WHERE block_number = $1 + ORDER BY eth.transaction_cids.index ASC` RetrieveReceiptByTxHashPgStr = `SELECT receipt_cids.cid, data FROM eth.receipt_cids INNER JOIN eth.transaction_cids ON (receipt_cids.tx_id = transaction_cids.id)