Skip to content

Commit

Permalink
eth/filter: add crit log before exit
Browse files Browse the repository at this point in the history
  • Loading branch information
rjl493456442 committed May 7, 2018
1 parent 96a79b9 commit f11ac1e
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions eth/filters/filter_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rpc"
)

Expand Down Expand Up @@ -129,25 +130,16 @@ func NewEventSystem(mux *event.TypeMux, backend Backend, lightMode bool) *EventS

// Subscribe events
m.txSub = m.backend.SubscribeTxPreEvent(m.txCh)
if m.txSub == nil {
return nil
}
m.logsSub = m.backend.SubscribeLogsEvent(m.logsCh)
if m.logsSub == nil {
return nil
}
m.rmLogsSub = m.backend.SubscribeRemovedLogsEvent(m.rmLogsCh)
if m.rmLogsSub == nil {
return nil
}
m.chainSub = m.backend.SubscribeChainEvent(m.chainCh)
if m.chainSub == nil {
return nil
}
// TODO(rjl493456442): use feed to subscribe pending log event
m.pendingLogSub = m.mux.Subscribe(core.PendingLogsEvent{})
if m.pendingLogSub.Closed() {
return nil

// Make sure all the subscriptions are not empty
if m.txSub == nil || m.logsSub == nil || m.rmLogsSub == nil || m.chainSub == nil ||
m.pendingLogSub.Closed() {
log.Crit("Subscribe for event system failed")
}

go m.eventLoop()
Expand Down

0 comments on commit f11ac1e

Please sign in to comment.