multi: start consumers with a starting blockbeat

This is needed so the consumers have an initial state about the current
block.
This commit is contained in:
yyforyongyu committed 2024-12-20 17:54:02 +08:00
1 parent 802353036e
commit 545cea0546
5 files changed
+60 -10

No files matched your search

+4 -1
View File
@@ -795,13 +795,16 @@ type monitorRecord struct {
// Start starts the publisher by subscribing to block epoch updates and kicking
// off the monitor loop.
func (t *TxPublisher) Start() error {
func (t *TxPublisher) Start(beat chainio.Blockbeat) error {
log.Info("TxPublisher starting...")
if t.started.Swap(true) {
return fmt.Errorf("TxPublisher started more than once")
}
// Set the current height.
t.currentHeight.Store(beat.Height())
t.wg.Add(1)
go t.monitor()