fix getLogs for txnHash

pull/3577/head
Rongjian Lan 4 years ago
parent db9d239732
commit 9209234e36
  1. 11
      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 {
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 = receipts[i].TxHash
receipts[i].Logs[j].TxHash = ethHash
}
}
}
}

Loading…
Cancel
Save