to be consistent with WatchOpts

which is at accounts/abi/bind/base.go:85
This commit is contained in:
Tung Vu 2024-09-15 22:54:46 +07:00 committed by Tung Vu
parent ae707445f5
commit 376d283669
No known key found for this signature in database
GPG key ID: DE9B0F576188226F
2 changed files with 2 additions and 6 deletions

View file

@ -466,12 +466,8 @@ func toFilterArg(q ethereum.FilterQuery) (interface{}, error) {
if q.FromBlock != nil || q.ToBlock != nil { if q.FromBlock != nil || q.ToBlock != nil {
return nil, errors.New("cannot specify both BlockHash and FromBlock/ToBlock") return nil, errors.New("cannot specify both BlockHash and FromBlock/ToBlock")
} }
} else {
if q.FromBlock == nil {
arg["fromBlock"] = "0x0"
} else { } else {
arg["fromBlock"] = toBlockNumArg(q.FromBlock) arg["fromBlock"] = toBlockNumArg(q.FromBlock)
}
arg["toBlock"] = toBlockNumArg(q.ToBlock) arg["toBlock"] = toBlockNumArg(q.ToBlock)
} }
return arg, nil return arg, nil

View file

@ -92,7 +92,7 @@ func TestToFilterArg(t *testing.T) {
}, },
map[string]interface{}{ map[string]interface{}{
"address": addresses, "address": addresses,
"fromBlock": "0x0", "fromBlock": "latest",
"toBlock": "latest", "toBlock": "latest",
"topics": [][]common.Hash{}, "topics": [][]common.Hash{},
}, },