diff --git a/hmy/blockchain.go b/hmy/blockchain.go index dd5ef0d66..0d47774f2 100644 --- a/hmy/blockchain.go +++ b/hmy/blockchain.go @@ -314,10 +314,19 @@ func (hmy *Harmony) GetLogs(ctx context.Context, blockHash common.Hash, isEth bo return nil, errors.New("Missing receipts") } if isEth { + block := hmy.BlockChain.GetBlockByHash(blockHash) + if block != nil { + return nil, errors.New("Missing block data") + } + txns := block.Transactions() for i, _ := range receipts { - for j, _ := range receipts[i].Logs { - // Override log txHash with receipt's - receipts[i].Logs[j].TxHash = receipts[i].TxHash + if i < len(txns) { + ethHash := txns[i].ConvertToEth().Hash() + receipts[i].TxHash = ethHash + for j, _ := range receipts[i].Logs { + // Override log txHash with receipt's + receipts[i].Logs[j].TxHash = ethHash + } } } }