From 0c21e1c6b5bb0f03786c9c713238d6f32e0cfcf0 Mon Sep 17 00:00:00 2001 From: Jaynti Kanani Date: Sun, 18 Oct 2020 18:01:25 +0530 Subject: [PATCH] sort logs before getting bor block receipt logs --- core/blockchain.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/blockchain.go b/core/blockchain.go index 4b0886f06f..2521e0cd8e 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1447,6 +1447,12 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types. // storing bor block receipt blockLogs := state.Logs() + if len(blockLogs) > 0 { + sort.SliceStable(blockLogs, func(i, j int) bool { + return blockLogs[i].Index < blockLogs[j].Index + }) + } + if len(blockLogs) > len(logs) { rawdb.WriteBorReceipt(blockBatch, block.Hash(), block.NumberU64(), &types.BorReceiptForStorage{ Logs: blockLogs[len(logs):],