@@ -363,7 +363,7 @@ func TestLogFilter(t *testing.T) {
363
363
// match all
364
364
0 : {FilterCriteria {}, allLogs , "" },
365
365
// match none due to no matching addresses
366
- 1 : {FilterCriteria {Addresses : []common.Address {{}, notUsedAddress }, Topics : [][]common.Hash {allLogs [ 0 ]. Topics }}, []* types.Log {}, "" },
366
+ 1 : {FilterCriteria {Addresses : []common.Address {{}, notUsedAddress }, Topics : [][]common.Hash {nil }}, []* types.Log {}, "" },
367
367
// match logs based on addresses, ignore topics
368
368
2 : {FilterCriteria {Addresses : []common.Address {firstAddr }}, allLogs [:2 ], "" },
369
369
// match none due to no matching topics (match with address)
@@ -384,6 +384,8 @@ func TestLogFilter(t *testing.T) {
384
384
10 : {FilterCriteria {FromBlock : big .NewInt (1 ), ToBlock : big .NewInt (2 ), Topics : [][]common.Hash {{secondTopic }}}, allLogs [3 :4 ], "" },
385
385
// all "mined" and pending logs with topic firstTopic
386
386
11 : {FilterCriteria {FromBlock : big .NewInt (rpc .LatestBlockNumber .Int64 ()), ToBlock : big .NewInt (rpc .PendingBlockNumber .Int64 ()), Topics : [][]common.Hash {{firstTopic }}}, expectedCase11 , "" },
387
+ // match all logs due to wildcard topic
388
+ 12 : {FilterCriteria {Topics : [][]common.Hash {nil }}, allLogs [1 :], "" },
387
389
}
388
390
)
389
391
@@ -459,7 +461,7 @@ func TestPendingLogsSubscription(t *testing.T) {
459
461
firstTopic = common .HexToHash ("0x1111111111111111111111111111111111111111111111111111111111111111" )
460
462
secondTopic = common .HexToHash ("0x2222222222222222222222222222222222222222222222222222222222222222" )
461
463
thirdTopic = common .HexToHash ("0x3333333333333333333333333333333333333333333333333333333333333333" )
462
- forthTopic = common .HexToHash ("0x4444444444444444444444444444444444444444444444444444444444444444" )
464
+ fourthTopic = common .HexToHash ("0x4444444444444444444444444444444444444444444444444444444444444444" )
463
465
notUsedTopic = common .HexToHash ("0x9999999999999999999999999999999999999999999999999999999999999999" )
464
466
465
467
allLogs = []core.PendingLogsEvent {
@@ -471,7 +473,7 @@ func TestPendingLogsSubscription(t *testing.T) {
471
473
{Logs : []* types.Log {
472
474
{Address : thirdAddress , Topics : []common.Hash {firstTopic }, BlockNumber : 5 },
473
475
{Address : thirdAddress , Topics : []common.Hash {thirdTopic }, BlockNumber : 5 },
474
- {Address : thirdAddress , Topics : []common.Hash {forthTopic }, BlockNumber : 5 },
476
+ {Address : thirdAddress , Topics : []common.Hash {fourthTopic }, BlockNumber : 5 },
475
477
{Address : firstAddr , Topics : []common.Hash {firstTopic }, BlockNumber : 5 },
476
478
}},
477
479
}
@@ -493,7 +495,7 @@ func TestPendingLogsSubscription(t *testing.T) {
493
495
// match all
494
496
{FilterCriteria {}, convertLogs (allLogs ), nil , nil },
495
497
// match none due to no matching addresses
496
- {FilterCriteria {Addresses : []common.Address {{}, notUsedAddress }, Topics : [][]common.Hash {{} }}, []* types.Log {}, nil , nil },
498
+ {FilterCriteria {Addresses : []common.Address {{}, notUsedAddress }, Topics : [][]common.Hash {nil }}, []* types.Log {}, nil , nil },
497
499
// match logs based on addresses, ignore topics
498
500
{FilterCriteria {Addresses : []common.Address {firstAddr }}, append (convertLogs (allLogs [:2 ]), allLogs [5 ].Logs [3 ]), nil , nil },
499
501
// match none due to no matching topics (match with address)
@@ -505,7 +507,7 @@ func TestPendingLogsSubscription(t *testing.T) {
505
507
// block numbers are ignored for filters created with New***Filter, these return all logs that match the given criteria when the state changes
506
508
{FilterCriteria {Addresses : []common.Address {firstAddr }, FromBlock : big .NewInt (2 ), ToBlock : big .NewInt (3 )}, append (convertLogs (allLogs [:2 ]), allLogs [5 ].Logs [3 ]), nil , nil },
507
509
// multiple pending logs, should match only 2 topics from the logs in block 5
508
- {FilterCriteria {Addresses : []common.Address {thirdAddress }, Topics : [][]common.Hash {{firstTopic , forthTopic }}}, []* types.Log {allLogs [5 ].Logs [0 ], allLogs [5 ].Logs [2 ]}, nil , nil },
510
+ {FilterCriteria {Addresses : []common.Address {thirdAddress }, Topics : [][]common.Hash {{firstTopic , fourthTopic }}}, []* types.Log {allLogs [5 ].Logs [0 ], allLogs [5 ].Logs [2 ]}, nil , nil },
509
511
}
510
512
)
511
513
0 commit comments