diff --git a/les/api_backend.go b/les/api_backend.go index 3b228e7374625e5a23c82ebb706372969ee8439c..89fd959ea3bd509fedc476980354e14ead9eb45b 100644 --- a/les/api_backend.go +++ b/les/api_backend.go @@ -24,7 +24,6 @@ import ( "github.com/maticnetwork/bor/accounts" "github.com/maticnetwork/bor/common" "github.com/maticnetwork/bor/common/math" - "github.com/maticnetwork/bor/consensus/bor" "github.com/maticnetwork/bor/core" "github.com/maticnetwork/bor/core/bloombits" "github.com/maticnetwork/bor/core/rawdb" @@ -166,8 +165,7 @@ func (b *LesApiBackend) SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) e } func (b *LesApiBackend) SubscribeStateEvent(ch chan<- core.NewStateChangeEvent) event.Subscription { - engine := b.eth.Engine() - return engine.(*bor.Bor).SubscribeStateEvent(ch) + return b.eth.blockchain.SubscribeStateEvent(ch) } func (b *LesApiBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription { diff --git a/light/lightchain.go b/light/lightchain.go index 99f14ee3caa60140b78404fd3b3c9a865a570838..32122f3434be11c8cd421cefdc5caf09f2eee09d 100644 --- a/light/lightchain.go +++ b/light/lightchain.go @@ -531,6 +531,12 @@ func (lc *LightChain) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) return lc.scope.Track(new(event.Feed).Subscribe(ch)) } +// SubscribeStateEvent implements the interface of filters.Backend +// LightChain does not send core.RemovedLogsEvent, so return an empty subscription. +func (lc *LightChain) SubscribeStateEvent(ch chan<- core.NewStateChangeEvent) event.Subscription { + return lc.scope.Track(new(event.Feed).Subscribe(ch)) +} + // DisableCheckFreq disables header validation. This is used for ultralight mode. func (lc *LightChain) DisableCheckFreq() { atomic.StoreInt32(&lc.disableCheckFreq, 1)