aboutsummaryrefslogtreecommitdiffstats
path: root/core/types/block.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-10-17 19:06:40 +0800
committerGitHub <noreply@github.com>2018-10-17 19:06:40 +0800
commit29f38589a29e434282a783433d9fbb565ce4231b (patch)
treede7c6ffb73580689fc066e98221c45ef0b0694a4 /core/types/block.go
parent21ab1ac7be6e88b88f75b10eb83d409bc0322254 (diff)
downloaddexon-consensus-29f38589a29e434282a783433d9fbb565ce4231b.tar
dexon-consensus-29f38589a29e434282a783433d9fbb565ce4231b.tar.gz
dexon-consensus-29f38589a29e434282a783433d9fbb565ce4231b.tar.bz2
dexon-consensus-29f38589a29e434282a783433d9fbb565ce4231b.tar.lz
dexon-consensus-29f38589a29e434282a783433d9fbb565ce4231b.tar.xz
dexon-consensus-29f38589a29e434282a783433d9fbb565ce4231b.tar.zst
dexon-consensus-29f38589a29e434282a783433d9fbb565ce4231b.zip
core: Some sync functions (#220)
Diffstat (limited to 'core/types/block.go')
-rw-r--r--core/types/block.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/types/block.go b/core/types/block.go
index 710da9b..bf27934 100644
--- a/core/types/block.go
+++ b/core/types/block.go
@@ -118,6 +118,11 @@ func (b *Block) IsGenesis() bool {
return b.Position.Height == 0 && b.ParentHash == common.Hash{}
}
+// IsFinalized checks if the finalization data is ready.
+func (b *Block) IsFinalized() bool {
+ return b.Finalization.Height != 0
+}
+
// IsAcking checks if a block acking another by it's hash.
func (b *Block) IsAcking(hash common.Hash) bool {
idx := sort.Search(len(b.Acks), func(i int) bool {