aboutsummaryrefslogtreecommitdiffstats
path: root/core/types/block.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-07-31 22:39:05 +0800
committerGitHub <noreply@github.com>2018-07-31 22:39:05 +0800
commitea2d10b0c7874e6c1d3dd1cf2487ad2525ebb59c (patch)
tree19de3fe44b3c4822f78bd2405f99c07c1130cdd8 /core/types/block.go
parent3778e956013cad171cd5954686831e2598de3045 (diff)
downloaddexon-consensus-ea2d10b0c7874e6c1d3dd1cf2487ad2525ebb59c.tar
dexon-consensus-ea2d10b0c7874e6c1d3dd1cf2487ad2525ebb59c.tar.gz
dexon-consensus-ea2d10b0c7874e6c1d3dd1cf2487ad2525ebb59c.tar.bz2
dexon-consensus-ea2d10b0c7874e6c1d3dd1cf2487ad2525ebb59c.tar.lz
dexon-consensus-ea2d10b0c7874e6c1d3dd1cf2487ad2525ebb59c.tar.xz
dexon-consensus-ea2d10b0c7874e6c1d3dd1cf2487ad2525ebb59c.tar.zst
dexon-consensus-ea2d10b0c7874e6c1d3dd1cf2487ad2525ebb59c.zip
core: refine Application interface and add Governance interface (#24)
Add a new Governance interface for interaction with the governance contract. Also remove the ValidateBlock call in application interface as the application should validate it before putting it into the consensus module. A new BlockConverter interface is also added. The consensus module should accept the BlockConverter interface in future implementation, and use the Block() function to get the underlying block info.
Diffstat (limited to 'core/types/block.go')
-rw-r--r--core/types/block.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/types/block.go b/core/types/block.go
index 61b6535..c445fd2 100644
--- a/core/types/block.go
+++ b/core/types/block.go
@@ -50,6 +50,12 @@ type Block struct {
Status Status `json:"-"`
}
+// BlockConverter interface define the interface for extracting block
+// information from an existing object.
+type BlockConverter interface {
+ Block() *Block
+}
+
func (b *Block) String() string {
return fmt.Sprintf("Block(%v)", b.Hash.String()[:6])
}