diff --git a/block/manager.go b/block/manager.go index 3d2839c3d77..4678d7fedb6 100644 --- a/block/manager.go +++ b/block/manager.go @@ -313,7 +313,7 @@ func (m *Manager) SyncLoop(ctx context.Context, cancel context.CancelFunc) { daHeight := blockEvent.daHeight blockHash := block.Hash().String() blockHeight := uint64(block.Height()) - m.logger.Debug("block body retrieved from DALC", + m.logger.Debug("block body retrieved", "height", blockHeight, "daHeight", daHeight, "hash", blockHash, @@ -437,6 +437,8 @@ func (m *Manager) BlockStoreRetrieveLoop(ctx context.Context) { daHeight := atomic.LoadUint64(&m.daHeight) for _, block := range blocks { m.blockInCh <- newBlockEvent{block, daHeight} + m.logger.Debug("block retrieved from p2p block sync", "blockHeight", block.Height(), "daHeight", daHeight) + } } lastBlockStoreHeight = blockStoreHeight @@ -648,6 +650,11 @@ func (m *Manager) publishBlock(ctx context.Context) error { if err != nil { return err } + + blockHeight := uint64(block.Height()) + // Update the stored height before submitting to the DA layer and committing to the DB + m.store.SetHeight(blockHeight) + blockHash := block.Hash().String() m.blockCache.setSeen(blockHash) @@ -669,8 +676,6 @@ func (m *Manager) publishBlock(ctx context.Context) error { m.pendingBlocks = append(m.pendingBlocks, block) m.pendingBlocksMtx.Unlock() - blockHeight := uint64(block.SignedHeader.Header.Height()) - // Commit the new state and block which writes to disk on the proxy app _, _, err = m.executor.Commit(ctx, newState, block, responses) if err != nil { @@ -689,9 +694,6 @@ func (m *Manager) publishBlock(ctx context.Context) error { return err } - // Only update the stored height after successfully submitting to DA layer and committing to the DB - m.store.SetHeight(blockHeight) - newState.DAHeight = atomic.LoadUint64(&m.daHeight) // After this call m.lastState is the NEW state returned from ApplyBlock // updateState also commits the DB tx