sort logs before getting bor block receipt logs

This commit is contained in:
Jaynti Kanani 2020-10-18 18:01:25 +05:30
parent 9539a72909
commit 0c21e1c6b5
No known key found for this signature in database
GPG key ID: 4396982C976BAE5E

View file

@ -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):],