Skip to content

Commit

Permalink
remove duplicated types
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Oct 24, 2024
1 parent 7ebe297 commit edfe178
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions jsonrpc/namespaces/eth/filters/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ var (
const maxTopics = 4

type filter struct {
ty ethfilters.Type
hashes []common.Hash
fullTx bool
txs []*rpctypes.RPCTransaction
crit ethfilters.FilterCriteria
logs []*coretypes.Log
Expand Down Expand Up @@ -186,8 +184,6 @@ func (api *FilterAPI) NewPendingTransactionFilter(fullTx *bool) (rpc.ID, error)

api.filtersMut.Lock()
api.filters[id] = &filter{

Check warning on line 186 in jsonrpc/namespaces/eth/filters/api.go

View check run for this annotation

Codecov / codecov/patch

jsonrpc/namespaces/eth/filters/api.go#L174-L186

Added lines #L174 - L186 were not covered by tests
ty: ethfilters.PendingTransactionsSubscription,
fullTx: fullTx != nil && *fullTx,
txs: make([]*rpctypes.RPCTransaction, 0),
hashes: make([]common.Hash, 0),
s: s,

Check warning on line 189 in jsonrpc/namespaces/eth/filters/api.go

View check run for this annotation

Codecov / codecov/patch

jsonrpc/namespaces/eth/filters/api.go#L189

Added line #L189 was not covered by tests
Expand Down Expand Up @@ -241,7 +237,6 @@ func (api *FilterAPI) NewBlockFilter() (rpc.ID, error) {

Check warning on line 237 in jsonrpc/namespaces/eth/filters/api.go

View check run for this annotation

Codecov / codecov/patch

jsonrpc/namespaces/eth/filters/api.go#L225-L237

Added lines #L225 - L237 were not covered by tests
api.filtersMut.Lock()
api.filters[id] = &filter{
ty: ethfilters.BlocksSubscription,
hashes: make([]common.Hash, 0),
s: s,

Check warning on line 241 in jsonrpc/namespaces/eth/filters/api.go

View check run for this annotation

Codecov / codecov/patch

jsonrpc/namespaces/eth/filters/api.go#L241

Added line #L241 was not covered by tests
}
Expand Down Expand Up @@ -318,7 +313,6 @@ func (api *FilterAPI) NewFilter(crit ethfilters.FilterCriteria) (rpc.ID, error)

Check warning on line 313 in jsonrpc/namespaces/eth/filters/api.go

View check run for this annotation

Codecov / codecov/patch

jsonrpc/namespaces/eth/filters/api.go#L300-L313

Added lines #L300 - L313 were not covered by tests
api.filtersMut.Lock()
api.filters[id] = &filter{
ty: ethfilters.LogsSubscription,
crit: crit, lastUsed: time.Now(),
logs: make([]*coretypes.Log, 0),
s: s,

Check warning on line 318 in jsonrpc/namespaces/eth/filters/api.go

View check run for this annotation

Codecov / codecov/patch

jsonrpc/namespaces/eth/filters/api.go#L318

Added line #L318 was not covered by tests
Expand Down Expand Up @@ -400,7 +394,7 @@ func (api *FilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*coretype
f, found := api.filters[id]
api.filtersMut.Unlock()

if !found || f.ty != ethfilters.LogsSubscription {
if !found || f.s.ty != ethfilters.LogsSubscription {

Check warning on line 397 in jsonrpc/namespaces/eth/filters/api.go

View check run for this annotation

Codecov / codecov/patch

jsonrpc/namespaces/eth/filters/api.go#L397

Added line #L397 was not covered by tests
return nil, errFilterNotFound
}

Expand Down Expand Up @@ -447,7 +441,7 @@ func (api *FilterAPI) GetFilterChanges(id rpc.ID) (interface{}, error) {

f.lastUsed = time.Now()

switch f.ty {
switch f.s.ty {

Check warning on line 444 in jsonrpc/namespaces/eth/filters/api.go

View check run for this annotation

Codecov / codecov/patch

jsonrpc/namespaces/eth/filters/api.go#L444

Added line #L444 was not covered by tests
case ethfilters.BlocksSubscription:
hashes := f.hashes
f.hashes = nil
Expand All @@ -459,7 +453,7 @@ func (api *FilterAPI) GetFilterChanges(id rpc.ID) (interface{}, error) {

return returnLogs(logs), nil
case ethfilters.PendingTransactionsSubscription:
if f.fullTx {
if f.s.fullTx {

Check warning on line 456 in jsonrpc/namespaces/eth/filters/api.go

View check run for this annotation

Codecov / codecov/patch

jsonrpc/namespaces/eth/filters/api.go#L456

Added line #L456 was not covered by tests
txs := f.txs
f.txs = nil

Expand Down

0 comments on commit edfe178

Please sign in to comment.