Populate log index.

This commit is contained in:
Ashwin Phatak 2021-07-13 15:46:39 +05:30
parent 3a9cc63bf3
commit e391af6b90

View File

@ -1014,6 +1014,7 @@ func (r *Resolver) GetLogs(ctx context.Context, args struct {
return nil, err
}
var logIndexInBlock uint = 0
receipts := make(types.Receipts, len(receiptsBytes))
for index, receiptBytes := range receiptsBytes {
receiptCID := receiptCIDs[index]
@ -1024,6 +1025,9 @@ func (r *Resolver) GetLogs(ctx context.Context, args struct {
receipts[index] = receipt
for _, log := range receipt.Logs {
log.Index = logIndexInBlock
logIndexInBlock++
if args.Contract == nil || *args.Contract == log.Address {
ret = append(ret, &Log{
backend: r.backend,