diff options
author | Felix Lange <fjl@twurst.com> | 2016-12-05 02:07:24 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2016-12-05 17:57:11 +0800 |
commit | f52a1ae849492480b6505ab7805305640518a568 (patch) | |
tree | 95918d77278e15d7dfd52ad24a967d291f6cfdcb /eth/filters/api.go | |
parent | 3bc0fe1ee3183311efe851aca8fd10d5a5433929 (diff) | |
download | go-tangerine-f52a1ae849492480b6505ab7805305640518a568.tar go-tangerine-f52a1ae849492480b6505ab7805305640518a568.tar.gz go-tangerine-f52a1ae849492480b6505ab7805305640518a568.tar.bz2 go-tangerine-f52a1ae849492480b6505ab7805305640518a568.tar.lz go-tangerine-f52a1ae849492480b6505ab7805305640518a568.tar.xz go-tangerine-f52a1ae849492480b6505ab7805305640518a568.tar.zst go-tangerine-f52a1ae849492480b6505ab7805305640518a568.zip |
core, core/vm, eth/filters: move Removed field into vm.Log
This field used to be assigned by the filter system and returned through
the RPC API. Now that we have a Go client that uses the underlying type,
the field needs to move. It is now assigned to true when the RemovedLogs
event is generated so the filter system doesn't need to care about the
field at all.
While here, remove the log list from ChainSideEvent. There are no users
of this field right now and any potential users could subscribe to
RemovedLogsEvent instead.
Diffstat (limited to 'eth/filters/api.go')
-rw-r--r-- | eth/filters/api.go | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/eth/filters/api.go b/eth/filters/api.go index d5dd57743..bbb34d3de 100644 --- a/eth/filters/api.go +++ b/eth/filters/api.go @@ -29,6 +29,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/rpc" @@ -45,7 +46,7 @@ type filter struct { deadline *time.Timer // filter is inactiv when deadline triggers hashes []common.Hash crit FilterCriteria - logs []Log + logs []*vm.Log s *Subscription // associated subscription in event system } @@ -241,7 +242,7 @@ func (api *PublicFilterAPI) Logs(ctx context.Context, crit FilterCriteria) (*rpc var ( rpcSub = notifier.CreateSubscription() - matchedLogs = make(chan []Log) + matchedLogs = make(chan []*vm.Log) ) logsSub, err := api.events.SubscribeLogs(crit, matchedLogs) @@ -292,14 +293,14 @@ type FilterCriteria struct { // // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newfilter func (api *PublicFilterAPI) NewFilter(crit FilterCriteria) (rpc.ID, error) { - logs := make(chan []Log) + logs := make(chan []*vm.Log) logsSub, err := api.events.SubscribeLogs(crit, logs) if err != nil { return rpc.ID(""), err } api.filtersMu.Lock() - api.filters[logsSub.ID] = &filter{typ: LogsSubscription, crit: crit, deadline: time.NewTimer(deadline), logs: make([]Log, 0), s: logsSub} + api.filters[logsSub.ID] = &filter{typ: LogsSubscription, crit: crit, deadline: time.NewTimer(deadline), logs: make([]*vm.Log, 0), s: logsSub} api.filtersMu.Unlock() go func() { @@ -326,7 +327,7 @@ func (api *PublicFilterAPI) NewFilter(crit FilterCriteria) (rpc.ID, error) { // GetLogs returns logs matching the given argument that are stored within the state. // // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs -func (api *PublicFilterAPI) GetLogs(ctx context.Context, crit FilterCriteria) ([]Log, error) { +func (api *PublicFilterAPI) GetLogs(ctx context.Context, crit FilterCriteria) ([]*vm.Log, error) { if crit.FromBlock == nil { crit.FromBlock = big.NewInt(rpc.LatestBlockNumber.Int64()) } @@ -365,7 +366,7 @@ func (api *PublicFilterAPI) UninstallFilter(id rpc.ID) bool { // If the filter could not be found an empty array of logs is returned. // // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterlogs -func (api *PublicFilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]Log, error) { +func (api *PublicFilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*vm.Log, error) { api.filtersMu.Lock() f, found := api.filters[id] api.filtersMu.Unlock() @@ -388,7 +389,7 @@ func (api *PublicFilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]Log filter.SetAddresses(f.crit.Addresses) filter.SetTopics(f.crit.Topics) - logs, err:= filter.Find(ctx) + logs, err := filter.Find(ctx) if err != nil { return nil, err } @@ -440,9 +441,9 @@ func returnHashes(hashes []common.Hash) []common.Hash { // returnLogs is a helper that will return an empty log array in case the given logs array is nil, // otherwise the given logs array is returned. -func returnLogs(logs []Log) []Log { +func returnLogs(logs []*vm.Log) []*vm.Log { if logs == nil { - return []Log{} + return []*vm.Log{} } return logs } |