@@ -61,6 +61,7 @@ type Manager struct {
6161
6262 CommitInCh chan * types.Commit
6363 CommitOutCh chan * types.Commit
64+ lastCommit * types.Commit
6465
6566 syncTarget uint64
6667 blockInCh chan newBlockEvent
@@ -204,6 +205,9 @@ func (m *Manager) SyncLoop(ctx context.Context) {
204205 atomic .StoreUint64 (& m .syncTarget , newHeight )
205206 m .retrieveCond .Signal ()
206207 }
208+ case commit := <- m .CommitInCh :
209+ // TODO(tzdybal): check if it's from right aggregator
210+ m .lastCommit = commit
207211 case blockEvent := <- m .blockInCh :
208212 block := blockEvent .block
209213 daHeight := blockEvent .daHeight
@@ -438,6 +442,7 @@ func (m *Manager) publishBlock(ctx context.Context) error {
438442 m .store .SetHeight (block .Header .Height )
439443
440444 m .publishHeader (block )
445+ m .publishCommit (lastCommit )
441446
442447 return nil
443448}
@@ -476,10 +481,16 @@ func (m *Manager) exponentialBackoff(backoff time.Duration) time.Duration {
476481 return backoff
477482}
478483
484+ // TODO(tzdybal): consider inlining
479485func (m * Manager ) publishHeader (block * types.Block ) {
480486 m .HeaderOutCh <- & block .Header
481487}
482488
489+ // TODO(tzdybal): consider inlining
490+ func (m * Manager ) publishCommit (commit * types.Commit ) {
491+ m .CommitOutCh <- commit
492+ }
493+
483494func updateState (s * types.State , res * abci.ResponseInitChain ) {
484495 // If the app did not return an app hash, we keep the one set from the genesis doc in
485496 // the state. We don't set appHash since we don't want the genesis doc app hash
0 commit comments