diff options
author | Felix Lange <fjl@twurst.com> | 2017-01-05 21:03:50 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2017-01-06 21:15:22 +0800 |
commit | 7731061903bb992f7630ab389863951efb360258 (patch) | |
tree | ea706da87ce002a631cba30b171cb44dbdd7c2c6 /eth/filters/filter_system.go | |
parent | b9683d3748dcb73ab5a5474334eaf157267d9c4a (diff) | |
download | go-tangerine-7731061903bb992f7630ab389863951efb360258.tar go-tangerine-7731061903bb992f7630ab389863951efb360258.tar.gz go-tangerine-7731061903bb992f7630ab389863951efb360258.tar.bz2 go-tangerine-7731061903bb992f7630ab389863951efb360258.tar.lz go-tangerine-7731061903bb992f7630ab389863951efb360258.tar.xz go-tangerine-7731061903bb992f7630ab389863951efb360258.tar.zst go-tangerine-7731061903bb992f7630ab389863951efb360258.zip |
core/vm: move Log to core/types
This significantly reduces the dependency closure of ethclient, which no
longer depends on core/vm as of this change.
All uses of vm.Logs are replaced by []*types.Log. NewLog is gone too,
the constructor simply returned a literal.
Diffstat (limited to 'eth/filters/filter_system.go')
-rw-r--r-- | eth/filters/filter_system.go | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/eth/filters/filter_system.go b/eth/filters/filter_system.go index 1b360cfdb..7493dd231 100644 --- a/eth/filters/filter_system.go +++ b/eth/filters/filter_system.go @@ -27,7 +27,6 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/rpc" "golang.org/x/net/context" @@ -64,7 +63,7 @@ type subscription struct { typ Type created time.Time logsCrit FilterCriteria - logs chan []*vm.Log + logs chan []*types.Log hashes chan common.Hash headers chan *types.Header installed chan struct{} // closed when the filter is installed @@ -151,7 +150,7 @@ func (es *EventSystem) subscribe(sub *subscription) *Subscription { // SubscribeLogs creates a subscription that will write all logs matching the // given criteria to the given logs channel. Default value for the from and to // block is "latest". If the fromBlock > toBlock an error is returned. -func (es *EventSystem) SubscribeLogs(crit FilterCriteria, logs chan []*vm.Log) (*Subscription, error) { +func (es *EventSystem) SubscribeLogs(crit FilterCriteria, logs chan []*types.Log) (*Subscription, error) { var from, to rpc.BlockNumber if crit.FromBlock == nil { from = rpc.LatestBlockNumber @@ -189,7 +188,7 @@ func (es *EventSystem) SubscribeLogs(crit FilterCriteria, logs chan []*vm.Log) ( // subscribeMinedPendingLogs creates a subscription that returned mined and // pending logs that match the given criteria. -func (es *EventSystem) subscribeMinedPendingLogs(crit FilterCriteria, logs chan []*vm.Log) *Subscription { +func (es *EventSystem) subscribeMinedPendingLogs(crit FilterCriteria, logs chan []*types.Log) *Subscription { sub := &subscription{ id: rpc.NewID(), typ: MinedAndPendingLogsSubscription, @@ -207,7 +206,7 @@ func (es *EventSystem) subscribeMinedPendingLogs(crit FilterCriteria, logs chan // subscribeLogs creates a subscription that will write all logs matching the // given criteria to the given logs channel. -func (es *EventSystem) subscribeLogs(crit FilterCriteria, logs chan []*vm.Log) *Subscription { +func (es *EventSystem) subscribeLogs(crit FilterCriteria, logs chan []*types.Log) *Subscription { sub := &subscription{ id: rpc.NewID(), typ: LogsSubscription, @@ -225,7 +224,7 @@ func (es *EventSystem) subscribeLogs(crit FilterCriteria, logs chan []*vm.Log) * // subscribePendingLogs creates a subscription that writes transaction hashes for // transactions that enter the transaction pool. -func (es *EventSystem) subscribePendingLogs(crit FilterCriteria, logs chan []*vm.Log) *Subscription { +func (es *EventSystem) subscribePendingLogs(crit FilterCriteria, logs chan []*types.Log) *Subscription { sub := &subscription{ id: rpc.NewID(), typ: PendingLogsSubscription, @@ -248,7 +247,7 @@ func (es *EventSystem) SubscribeNewHeads(headers chan *types.Header) *Subscripti id: rpc.NewID(), typ: BlocksSubscription, created: time.Now(), - logs: make(chan []*vm.Log), + logs: make(chan []*types.Log), hashes: make(chan common.Hash), headers: headers, installed: make(chan struct{}), @@ -265,7 +264,7 @@ func (es *EventSystem) SubscribePendingTxEvents(hashes chan common.Hash) *Subscr id: rpc.NewID(), typ: PendingTransactionsSubscription, created: time.Now(), - logs: make(chan []*vm.Log), + logs: make(chan []*types.Log), hashes: hashes, headers: make(chan *types.Header), installed: make(chan struct{}), @@ -284,7 +283,7 @@ func (es *EventSystem) broadcast(filters filterIndex, ev *event.Event) { } switch e := ev.Data.(type) { - case vm.Logs: + case []*types.Log: if len(e) > 0 { for _, f := range filters[LogsSubscription] { if ev.Time.After(f.created) { @@ -370,7 +369,7 @@ func (es *EventSystem) lightFilterNewHead(newHeader *types.Header, callBack func } // filter logs of a single header in light client mode -func (es *EventSystem) lightFilterLogs(header *types.Header, addresses []common.Address, topics [][]common.Hash, remove bool) []*vm.Log { +func (es *EventSystem) lightFilterLogs(header *types.Header, addresses []common.Address, topics [][]common.Hash, remove bool) []*types.Log { if bloomFilter(header.Bloom, addresses, topics) { // Get the logs of the block ctx, _ := context.WithTimeout(context.Background(), time.Second*5) @@ -378,7 +377,7 @@ func (es *EventSystem) lightFilterLogs(header *types.Header, addresses []common. if err != nil { return nil } - var unfiltered []*vm.Log + var unfiltered []*types.Log for _, receipt := range receipts { for _, log := range receipt.Logs { logcopy := *log @@ -396,7 +395,7 @@ func (es *EventSystem) lightFilterLogs(header *types.Header, addresses []common. func (es *EventSystem) eventLoop() { var ( index = make(filterIndex) - sub = es.mux.Subscribe(core.PendingLogsEvent{}, core.RemovedLogsEvent{}, vm.Logs{}, core.TxPreEvent{}, core.ChainEvent{}) + sub = es.mux.Subscribe(core.PendingLogsEvent{}, core.RemovedLogsEvent{}, []*types.Log{}, core.TxPreEvent{}, core.ChainEvent{}) ) for i := UnknownSubscription; i < LastIndexSubscription; i++ { |