aboutsummaryrefslogtreecommitdiffstats
path: root/core/types
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-10-23 09:43:24 +0800
committerGitHub <noreply@github.com>2018-10-23 09:43:24 +0800
commit56cbbbaf4c638264cbf3ceb5cf16161b6adf2bc3 (patch)
treed52155ea22e6bcfae6ac062893c32186005c362f /core/types
parent6fbd0cd47fd70cfad707e95bc9fb948e7b44d4cf (diff)
downloaddexon-consensus-56cbbbaf4c638264cbf3ceb5cf16161b6adf2bc3.tar
dexon-consensus-56cbbbaf4c638264cbf3ceb5cf16161b6adf2bc3.tar.gz
dexon-consensus-56cbbbaf4c638264cbf3ceb5cf16161b6adf2bc3.tar.bz2
dexon-consensus-56cbbbaf4c638264cbf3ceb5cf16161b6adf2bc3.tar.lz
dexon-consensus-56cbbbaf4c638264cbf3ceb5cf16161b6adf2bc3.tar.xz
dexon-consensus-56cbbbaf4c638264cbf3ceb5cf16161b6adf2bc3.tar.zst
dexon-consensus-56cbbbaf4c638264cbf3ceb5cf16161b6adf2bc3.zip
core: prepare empty block if null block is confirmed by BA. (#231)
Diffstat (limited to 'core/types')
-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 c8ee3c6..9de4673 100644
--- a/core/types/block.go
+++ b/core/types/block.go
@@ -257,6 +257,11 @@ func (b *Block) IsFinalized() bool {
return b.Finalization.Height != 0
}
+// IsEmpty checks if the block is an 'empty block'.
+func (b *Block) IsEmpty() bool {
+ return b.ProposerID.Hash == common.Hash{}
+}
+
// 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 {