// called after mux is stopped will return ErrMuxClosed.
//
// The zero value is ready to use.
-//
-// Deprecated: use Feed
type Dispatcher struct {
mutex sync.RWMutex
subm map[reflect.Type][]*Subscription
return
}
- if isOrphan, err := sm.chain.ValidateTx(tx); err != nil && isOrphan == false {
+ if isOrphan, err := sm.chain.ValidateTx(tx); err != nil && !isOrphan {
sm.peers.addBanScore(peer.ID(), 10, 0, "fail on validate tx transaction")
}
}
//Stop stop sync manager
func (sm *SyncManager) Stop() {
- sm.minedBlockSub.Unsubscribe()
close(sm.quitSync)
+ sm.minedBlockSub.Unsubscribe()
sm.sw.Stop()
}
func (sm *SyncManager) minedBroadcastLoop() {
for {
select {
- case obj := <-sm.minedBlockSub.Chan():
+ case obj, ok := <-sm.minedBlockSub.Chan():
+ if !ok {
+ log.WithFields(log.Fields{"module": logModule}).Warning("mined block subscription channel closed")
+ return
+ }
+
ev, ok := obj.Data.(event.NewMinedBlockEvent)
if !ok {
log.WithFields(log.Fields{"module": logModule}).Error("event type error")