File tree Expand file tree Collapse file tree 4 files changed +30
-12
lines changed Expand file tree Collapse file tree 4 files changed +30
-12
lines changed Original file line number Diff line number Diff line change @@ -44,11 +44,11 @@ type Log struct {
4444 // hash of the transaction
4545 TxHash common.Hash `json:"transactionHash" gencodec:"required"`
4646 // index of the transaction in the block
47- TxIndex uint `json:"transactionIndex" gencodec:"required" `
47+ TxIndex uint `json:"transactionIndex"`
4848 // hash of the block in which the transaction was included
4949 BlockHash common.Hash `json:"blockHash"`
5050 // index of the log in the block
51- Index uint `json:"logIndex" gencodec:"required" `
51+ Index uint `json:"logIndex"`
5252
5353 // The Removed field is true if this log was reverted due to a chain reorganisation.
5454 // You must pay attention to this field if you receive logs through a filter query.
Original file line number Diff line number Diff line change @@ -282,6 +282,10 @@ func toBlockNumArg(number *big.Int) string {
282282 if number == nil {
283283 return "latest"
284284 }
285+ pending := big .NewInt (- 1 )
286+ if number .Cmp (pending ) == 0 {
287+ return "pending"
288+ }
285289 return hexutil .EncodeBig (number )
286290}
287291
Original file line number Diff line number Diff line change @@ -97,6 +97,22 @@ func TestToFilterArg(t *testing.T) {
9797 },
9898 nil ,
9999 },
100+ {
101+ "with negative fromBlock and negative toBlock" ,
102+ ethereum.FilterQuery {
103+ Addresses : addresses ,
104+ FromBlock : big .NewInt (- 1 ),
105+ ToBlock : big .NewInt (- 1 ),
106+ Topics : [][]common.Hash {},
107+ },
108+ map [string ]interface {}{
109+ "address" : addresses ,
110+ "fromBlock" : "pending" ,
111+ "toBlock" : "pending" ,
112+ "topics" : [][]common.Hash {},
113+ },
114+ nil ,
115+ },
100116 {
101117 "with blockhash" ,
102118 ethereum.FilterQuery {
You can’t perform that action at this time.
0 commit comments