Ver código fonte

mobile: fix FilterLogs (#15418)

All logs in the FilterLog return value would be the same object 
because the for loop captured the pointer to the iteration variable.
Eugene Valeyev 8 anos atrás
pai
commit
bfdc0fa362
1 arquivos alterados com 2 adições e 2 exclusões
  1. 2 2
      mobile/ethclient.go

+ 2 - 2
mobile/ethclient.go

@@ -198,8 +198,8 @@ func (ec *EthereumClient) FilterLogs(ctx *Context, query *FilterQuery) (logs *Lo
 	}
 	// Temp hack due to vm.Logs being []*vm.Log
 	res := make([]*types.Log, len(rawLogs))
-	for i, log := range rawLogs {
-		res[i] = &log
+	for i := range rawLogs {
+		res[i] = &rawLogs[i]
 	}
 	return &Logs{res}, nil
 }