@@ -51,9 +51,9 @@ type filter struct {
5151 s * Subscription // associated subscription in event system
5252}
5353
54- // PublicFilterAPI offers support to create and manage filters. This will allow external clients to retrieve various
54+ // FilterAPI offers support to create and manage filters. This will allow external clients to retrieve various
5555// information related to the Ethereum protocol such als blocks, transactions and logs.
56- type PublicFilterAPI struct {
56+ type FilterAPI struct {
5757 backend Backend
5858 chainDb ethdb.Database
5959 events * EventSystem
@@ -62,9 +62,9 @@ type PublicFilterAPI struct {
6262 timeout time.Duration
6363}
6464
65- // NewPublicFilterAPI returns a new PublicFilterAPI instance.
66- func NewPublicFilterAPI (backend Backend , lightMode bool , timeout time.Duration ) * PublicFilterAPI {
67- api := & PublicFilterAPI {
65+ // NewFilterAPI returns a new FilterAPI instance.
66+ func NewFilterAPI (backend Backend , lightMode bool , timeout time.Duration ) * FilterAPI {
67+ api := & FilterAPI {
6868 backend : backend ,
6969 chainDb : backend .ChainDb (),
7070 events : NewEventSystem (backend , lightMode ),
@@ -78,7 +78,7 @@ func NewPublicFilterAPI(backend Backend, lightMode bool, timeout time.Duration)
7878
7979// timeoutLoop runs every 5 minutes and deletes filters that have not been recently used.
8080// Tt is started when the api is created.
81- func (api * PublicFilterAPI ) timeoutLoop (timeout time.Duration ) {
81+ func (api * FilterAPI ) timeoutLoop (timeout time.Duration ) {
8282 var toUninstall []* Subscription
8383 ticker := time .NewTicker (timeout )
8484 for {
@@ -112,7 +112,7 @@ func (api *PublicFilterAPI) timeoutLoop(timeout time.Duration) {
112112// `eth_getFilterChanges` polling method that is also used for log filters.
113113//
114114// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newpendingtransactionfilter
115- func (api * PublicFilterAPI ) NewPendingTransactionFilter () rpc.ID {
115+ func (api * FilterAPI ) NewPendingTransactionFilter () rpc.ID {
116116 var (
117117 pendingTxs = make (chan []common.Hash )
118118 pendingTxSub = api .events .SubscribePendingTxs (pendingTxs )
@@ -145,7 +145,7 @@ func (api *PublicFilterAPI) NewPendingTransactionFilter() rpc.ID {
145145
146146// NewPendingTransactions creates a subscription that is triggered each time a transaction
147147// enters the transaction pool and was signed from one of the transactions this nodes manages.
148- func (api * PublicFilterAPI ) NewPendingTransactions (ctx context.Context ) (* rpc.Subscription , error ) {
148+ func (api * FilterAPI ) NewPendingTransactions (ctx context.Context ) (* rpc.Subscription , error ) {
149149 notifier , supported := rpc .NotifierFromContext (ctx )
150150 if ! supported {
151151 return & rpc.Subscription {}, rpc .ErrNotificationsUnsupported
@@ -182,7 +182,7 @@ func (api *PublicFilterAPI) NewPendingTransactions(ctx context.Context) (*rpc.Su
182182// It is part of the filter package since polling goes with eth_getFilterChanges.
183183//
184184// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newblockfilter
185- func (api * PublicFilterAPI ) NewBlockFilter () rpc.ID {
185+ func (api * FilterAPI ) NewBlockFilter () rpc.ID {
186186 var (
187187 headers = make (chan * types.Header )
188188 headerSub = api .events .SubscribeNewHeads (headers )
@@ -214,7 +214,7 @@ func (api *PublicFilterAPI) NewBlockFilter() rpc.ID {
214214}
215215
216216// NewHeads send a notification each time a new (header) block is appended to the chain.
217- func (api * PublicFilterAPI ) NewHeads (ctx context.Context ) (* rpc.Subscription , error ) {
217+ func (api * FilterAPI ) NewHeads (ctx context.Context ) (* rpc.Subscription , error ) {
218218 notifier , supported := rpc .NotifierFromContext (ctx )
219219 if ! supported {
220220 return & rpc.Subscription {}, rpc .ErrNotificationsUnsupported
@@ -244,7 +244,7 @@ func (api *PublicFilterAPI) NewHeads(ctx context.Context) (*rpc.Subscription, er
244244}
245245
246246// Logs creates a subscription that fires for all new log that match the given filter criteria.
247- func (api * PublicFilterAPI ) Logs (ctx context.Context , crit FilterCriteria ) (* rpc.Subscription , error ) {
247+ func (api * FilterAPI ) Logs (ctx context.Context , crit FilterCriteria ) (* rpc.Subscription , error ) {
248248 notifier , supported := rpc .NotifierFromContext (ctx )
249249 if ! supported {
250250 return & rpc.Subscription {}, rpc .ErrNotificationsUnsupported
@@ -298,7 +298,7 @@ type FilterCriteria ethereum.FilterQuery
298298// In case "fromBlock" > "toBlock" an error is returned.
299299//
300300// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newfilter
301- func (api * PublicFilterAPI ) NewFilter (crit FilterCriteria ) (rpc.ID , error ) {
301+ func (api * FilterAPI ) NewFilter (crit FilterCriteria ) (rpc.ID , error ) {
302302 logs := make (chan []* types.Log )
303303 logsSub , err := api .events .SubscribeLogs (ethereum .FilterQuery (crit ), logs )
304304 if err != nil {
@@ -333,7 +333,7 @@ func (api *PublicFilterAPI) NewFilter(crit FilterCriteria) (rpc.ID, error) {
333333// GetLogs returns logs matching the given argument that are stored within the state.
334334//
335335// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs
336- func (api * PublicFilterAPI ) GetLogs (ctx context.Context , crit FilterCriteria ) ([]* types.Log , error ) {
336+ func (api * FilterAPI ) GetLogs (ctx context.Context , crit FilterCriteria ) ([]* types.Log , error ) {
337337 if len (crit .Topics ) > maxTopics {
338338 return nil , errExceedMaxTopics
339339 }
@@ -366,7 +366,7 @@ func (api *PublicFilterAPI) GetLogs(ctx context.Context, crit FilterCriteria) ([
366366// UninstallFilter removes the filter with the given filter id.
367367//
368368// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_uninstallfilter
369- func (api * PublicFilterAPI ) UninstallFilter (id rpc.ID ) bool {
369+ func (api * FilterAPI ) UninstallFilter (id rpc.ID ) bool {
370370 api .filtersMu .Lock ()
371371 f , found := api .filters [id ]
372372 if found {
@@ -384,7 +384,7 @@ func (api *PublicFilterAPI) UninstallFilter(id rpc.ID) bool {
384384// If the filter could not be found an empty array of logs is returned.
385385//
386386// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterlogs
387- func (api * PublicFilterAPI ) GetFilterLogs (ctx context.Context , id rpc.ID ) ([]* types.Log , error ) {
387+ func (api * FilterAPI ) GetFilterLogs (ctx context.Context , id rpc.ID ) ([]* types.Log , error ) {
388388 api .filtersMu .Lock ()
389389 f , found := api .filters [id ]
390390 api .filtersMu .Unlock ()
@@ -425,7 +425,7 @@ func (api *PublicFilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*ty
425425// (pending)Log filters return []Log.
426426//
427427// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterchanges
428- func (api * PublicFilterAPI ) GetFilterChanges (id rpc.ID ) (interface {}, error ) {
428+ func (api * FilterAPI ) GetFilterChanges (id rpc.ID ) (interface {}, error ) {
429429 api .filtersMu .Lock ()
430430 defer api .filtersMu .Unlock ()
431431
0 commit comments