MCPcopy Create free account
hub / github.com/CPChain/chain / PostChainEvents

Method PostChainEvents

core/blockchain.go:1743–1763  ·  view source on GitHub ↗

PostChainEvents iterates over the events generated by a chain insertion and posts them into the event feed. TODO: Should not expose PostChainEvents. The chain events should be posted in WriteBlock.

(events []interface{}, logs []*types.Log)

Source from the content-addressed store, hash-verified

1741// posts them into the event feed.
1742// TODO: Should not expose PostChainEvents. The chain events should be posted in WriteBlock.
1743func (bc *BlockChain) PostChainEvents(events []interface{}, logs []*types.Log) {
1744 // post event logs for further processing
1745 if logs != nil {
1746 bc.logsFeed.Send(logs)
1747 }
1748 for _, event := range events {
1749 switch ev := event.(type) {
1750 case ChainEvent:
1751 bc.chainFeed.Send(ev)
1752
1753 case ChainHeadEvent:
1754 bc.chainHeadFeed.Send(ev)
1755
1756 case ChainSideEvent:
1757 bc.chainSideFeed.Send(ev)
1758
1759 case ChainLatestEvent:
1760 bc.chainLatestFeed.Send(ev)
1761 }
1762 }
1763}
1764
1765func (bc *BlockChain) update() {
1766 futureTimer := time.NewTicker(10 * time.Second)

Callers 1

InsertChainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected