aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/dexon-foundation/dexon-consensus-core/core/consensus.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-10-31 14:02:39 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:17 +0800
commit79b3816f9ac27e151d2b9d6a76790fac8787e978 (patch)
tree4ed14fa46d27ce54e5550a1cd1af81dde0bdffd6 /vendor/github.com/dexon-foundation/dexon-consensus-core/core/consensus.go
parent0cbf04193ea79661f191cdaaca8f179d8b5db999 (diff)
downloadgo-tangerine-79b3816f9ac27e151d2b9d6a76790fac8787e978.tar
go-tangerine-79b3816f9ac27e151d2b9d6a76790fac8787e978.tar.gz
go-tangerine-79b3816f9ac27e151d2b9d6a76790fac8787e978.tar.bz2
go-tangerine-79b3816f9ac27e151d2b9d6a76790fac8787e978.tar.lz
go-tangerine-79b3816f9ac27e151d2b9d6a76790fac8787e978.tar.xz
go-tangerine-79b3816f9ac27e151d2b9d6a76790fac8787e978.tar.zst
go-tangerine-79b3816f9ac27e151d2b9d6a76790fac8787e978.zip
vendor: sync consensus core and fix conflict
Diffstat (limited to 'vendor/github.com/dexon-foundation/dexon-consensus-core/core/consensus.go')
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus-core/core/consensus.go26
1 files changed, 16 insertions, 10 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus-core/core/consensus.go b/vendor/github.com/dexon-foundation/dexon-consensus-core/core/consensus.go
index 938337f1c..394ae36a1 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus-core/core/consensus.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus-core/core/consensus.go
@@ -910,6 +910,20 @@ func (con *Consensus) preProcessBlock(b *types.Block) (err error) {
return
}
+// deliverBlock deliver a block to application layer.
+func (con *Consensus) deliverBlock(b *types.Block) {
+ // TODO(mission): clone types.FinalizationResult
+ con.logger.Debug("Calling Application.BlockDelivered", "block", b)
+ con.app.BlockDelivered(b.Hash, b.Finalization)
+ if b.Position.Round+2 == con.roundToNotify {
+ // Only the first block delivered of that round would
+ // trigger this noitification.
+ con.gov.NotifyRoundHeight(
+ con.roundToNotify, b.Finalization.Height)
+ con.roundToNotify++
+ }
+}
+
// processBlock is the entry point to submit one block to a Consensus instance.
func (con *Consensus) processBlock(block *types.Block) (err error) {
if err = con.db.Put(*block); err != nil && err != blockdb.ErrBlockExists {
@@ -936,8 +950,7 @@ func (con *Consensus) processBlock(block *types.Block) (err error) {
panic(err)
}
con.cfgModule.untouchTSigHash(b.Hash)
- // TODO(mission): clone types.FinalizationResult
- con.app.BlockDelivered(b.Hash, b.Finalization)
+ con.deliverBlock(b)
}
if err = con.lattice.PurgeBlocks(deliveredBlocks); err != nil {
return
@@ -966,14 +979,7 @@ func (con *Consensus) processFinalizedBlock(block *types.Block) (err error) {
}
err = nil
}
- con.app.BlockDelivered(b.Hash, b.Finalization)
- if b.Position.Round+2 == con.roundToNotify {
- // Only the first block delivered of that round would
- // trigger this noitification.
- con.gov.NotifyRoundHeight(
- con.roundToNotify, b.Finalization.Height)
- con.roundToNotify++
- }
+ con.deliverBlock(b)
}
}
return