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 {
44
44
// hash of the transaction
45
45
TxHash common.Hash `json:"transactionHash" gencodec:"required"`
46
46
// index of the transaction in the block
47
- TxIndex uint `json:"transactionIndex" gencodec:"required" `
47
+ TxIndex uint `json:"transactionIndex"`
48
48
// hash of the block in which the transaction was included
49
49
BlockHash common.Hash `json:"blockHash"`
50
50
// index of the log in the block
51
- Index uint `json:"logIndex" gencodec:"required" `
51
+ Index uint `json:"logIndex"`
52
52
53
53
// The Removed field is true if this log was reverted due to a chain reorganisation.
54
54
// 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 {
282
282
if number == nil {
283
283
return "latest"
284
284
}
285
+ pending := big .NewInt (- 1 )
286
+ if number .Cmp (pending ) == 0 {
287
+ return "pending"
288
+ }
285
289
return hexutil .EncodeBig (number )
286
290
}
287
291
Original file line number Diff line number Diff line change @@ -97,6 +97,22 @@ func TestToFilterArg(t *testing.T) {
97
97
},
98
98
nil ,
99
99
},
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
+ },
100
116
{
101
117
"with blockhash" ,
102
118
ethereum.FilterQuery {
You can’t perform that action at this time.
0 commit comments