Lowercase log address

This commit is contained in:
Matt Krump 2018-01-15 11:21:08 -06:00
parent 431be46005
commit 50f00b80c1
2 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,8 @@
package geth
import (
"strings"
"github.com/8thlight/vulcanizedb/pkg/core"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
@ -13,7 +15,7 @@ func LogToCoreLog(gethLog types.Log) core.Log {
hexTopics[i] = topic.Hex()
}
return core.Log{
Address: gethLog.Address.Hex(),
Address: strings.ToLower(gethLog.Address.Hex()),
BlockNumber: int64(gethLog.BlockNumber),
Topics: hexTopics,

View File

@ -1,6 +1,8 @@
package geth_test
import (
"strings"
"github.com/8thlight/vulcanizedb/pkg/core"
"github.com/8thlight/vulcanizedb/pkg/geth"
"github.com/ethereum/go-ethereum/common"
@ -14,7 +16,7 @@ var _ = Describe("Conversion of GethLog to core.Log", func() {
It("converts geth log to internal log format", func() {
gethLog := types.Log{
Address: common.HexToAddress("0xecf8f87f810ecf450940c9f60066b4a7a501d6a7"),
Address: common.HexToAddress("0x448a5065aeBB8E423F0896E6c5D525C040f59af3"),
BlockHash: common.HexToHash("0x656c34545f90a730a19008c0e7a7cd4fb3895064b48d6d69761bd5abad681056"),
BlockNumber: 2019236,
Data: hexutil.MustDecode("0x000000000000000000000000000000000000000000000001a055690d9db80000"),
@ -28,7 +30,7 @@ var _ = Describe("Conversion of GethLog to core.Log", func() {
}
expected := core.Log{
Address: gethLog.Address.Hex(),
Address: strings.ToLower(gethLog.Address.Hex()),
BlockNumber: int64(gethLog.BlockNumber),
Data: hexutil.Encode(gethLog.Data),
TxHash: gethLog.TxHash.Hex(),