aboutsummaryrefslogtreecommitdiffstats
path: root/core/consensus.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/consensus.go')
-rw-r--r--core/consensus.go18
1 files changed, 11 insertions, 7 deletions
diff --git a/core/consensus.go b/core/consensus.go
index a6d8037..a0336ed 100644
--- a/core/consensus.go
+++ b/core/consensus.go
@@ -1003,6 +1003,14 @@ func (con *Consensus) preProcessBlock(b *types.Block) (err error) {
// deliverBlock deliver a block to application layer.
func (con *Consensus) deliverBlock(b *types.Block) {
+ if err := con.db.UpdateBlock(*b); err != nil {
+ panic(err)
+ }
+ if err := con.db.PutCompactionChainTipInfo(
+ b.Hash, b.Finalization.Height); err != nil {
+ panic(err)
+ }
+ con.cfgModule.untouchTSigHash(b.Hash)
con.logger.Debug("Calling Application.BlockDelivered", "block", b)
con.app.BlockDelivered(b.Hash, b.Position, b.Finalization.Clone())
if b.Position.Round == con.roundToNotify {
@@ -1032,6 +1040,9 @@ func (con *Consensus) deliverBlock(b *types.Block) {
con.roundToNotify, b.Finalization.Height)
con.roundToNotify++
}
+ if con.debugApp != nil {
+ con.debugApp.BlockReady(b.Hash)
+ }
}
// processBlock is the entry point to submit one block to a Consensus instance.
@@ -1072,14 +1083,7 @@ func (con *Consensus) processBlock(block *types.Block) (err error) {
"delivered", con.ccModule.lastDeliveredBlock(),
"pending", con.ccModule.lastPendingBlock())
for _, b := range deliveredBlocks {
- if err = con.db.UpdateBlock(*b); err != nil {
- panic(err)
- }
- con.cfgModule.untouchTSigHash(b.Hash)
con.deliverBlock(b)
- if con.debugApp != nil {
- con.debugApp.BlockReady(b.Hash)
- }
}
if err = con.lattice.PurgeBlocks(deliveredBlocks); err != nil {
return