Skip to content

Commit

Permalink
chain event header lit
Browse files Browse the repository at this point in the history
  • Loading branch information
ucwong committed Oct 19, 2024
1 parent 4ae4d98 commit 223c695
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.

if status == CanonStatTy {
logs := bc.collectLogs(block, false)
bc.chainFeed.Send(ChainEvent{Block: block, Hash: block.Hash(), Logs: logs})
bc.chainFeed.Send(ChainEvent{Header: block.Header(), Hash: block.Hash(), Logs: logs})
if len(logs) > 0 {
bc.logsFeed.Send(logs)
}
Expand Down
6 changes: 3 additions & 3 deletions core/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ type NewMinedBlockEvent struct{ Block *types.Block }
type RemovedLogsEvent struct{ Logs []*types.Log }

type ChainEvent struct {
Block *types.Block
Hash common.Hash
Logs []*types.Log
Header *types.Header
Hash common.Hash
Logs []*types.Log
}

type ChainSideEvent struct {
Expand Down
4 changes: 2 additions & 2 deletions ctxc/filters/filter_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,10 @@ func (es *EventSystem) handleTxsEvent(filters filterIndex, ev core.NewTxsEvent)

func (es *EventSystem) handleChainEvent(filters filterIndex, ev core.ChainEvent) {
for _, f := range filters[BlocksSubscription] {
f.headers <- ev.Block.Header()
f.headers <- ev.Header
}
if es.lightMode && len(filters[LogsSubscription]) > 0 {
es.lightFilterNewHead(ev.Block.Header(), func(header *types.Header, remove bool) {
es.lightFilterNewHead(ev.Header, func(header *types.Header, remove bool) {
for _, f := range filters[LogsSubscription] {
if matchedLogs := es.lightFilterLogs(header, f.logsCrit.Addresses, f.logsCrit.Topics, remove); len(matchedLogs) > 0 {
f.logs <- matchedLogs
Expand Down

0 comments on commit 223c695

Please sign in to comment.