forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(chain_stream): relevant events are collected in a channel in ord…
…er to be consumed in app - optional addition to run in binary - performance impact not too relevant as most wont run this
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package baseapp | ||
|
||
import ( | ||
"time" | ||
|
||
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" | ||
) | ||
|
||
type StreamEvents struct { | ||
Events []abci.Event | ||
Height uint64 | ||
BlockTime time.Time | ||
Flush bool | ||
} | ||
|
||
func (app *BaseApp) AddStreamEvents(height int64, blockTime time.Time, events []abci.Event, flush bool) { | ||
if app.EnableStreamer { | ||
app.StreamEvents <- StreamEvents{ | ||
Events: events, | ||
Height: uint64(height), | ||
BlockTime: blockTime, | ||
Flush: flush, | ||
} | ||
} | ||
} |