diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-09-03 11:04:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-03 11:04:05 +0800 |
commit | 3410f1156703a7249bade6e3cc90b60a1fcefa54 (patch) | |
tree | e75bdecc1207322720335d33cf778c2d0c820323 /core/interfaces.go | |
parent | c8d3092208f73ee991a123052a71b7dbf7fffc27 (diff) | |
download | tangerine-consensus-3410f1156703a7249bade6e3cc90b60a1fcefa54.tar tangerine-consensus-3410f1156703a7249bade6e3cc90b60a1fcefa54.tar.gz tangerine-consensus-3410f1156703a7249bade6e3cc90b60a1fcefa54.tar.bz2 tangerine-consensus-3410f1156703a7249bade6e3cc90b60a1fcefa54.tar.lz tangerine-consensus-3410f1156703a7249bade6e3cc90b60a1fcefa54.tar.xz tangerine-consensus-3410f1156703a7249bade6e3cc90b60a1fcefa54.tar.zst tangerine-consensus-3410f1156703a7249bade6e3cc90b60a1fcefa54.zip |
core: minor change to governance interface (#90)
Diffstat (limited to 'core/interfaces.go')
-rw-r--r-- | core/interfaces.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/core/interfaces.go b/core/interfaces.go index 55df106..44f2308 100644 --- a/core/interfaces.go +++ b/core/interfaces.go @@ -20,6 +20,8 @@ package core import ( "time" + "github.com/shopspring/decimal" + "github.com/dexon-foundation/dexon-consensus-core/common" "github.com/dexon-foundation/dexon-consensus-core/core/types" ) @@ -55,10 +57,36 @@ type Application interface { type Network interface { // BroadcastVote broadcasts vote to all nodes in DEXON network. BroadcastVote(vote *types.Vote) + // BroadcastBlock broadcasts block to all nodes in DEXON network. BroadcastBlock(block *types.Block) + // BroadcastNotaryAck broadcasts notaryAck to all nodes in DEXON network. BroadcastNotaryAck(notaryAck *types.NotaryAck) + // ReceiveChan returns a channel to receive messages from DEXON network. ReceiveChan() <-chan interface{} } + +// Governance interface specifies interface to control the governance contract. +// Note that there are a lot more methods in the governance contract, that this +// interface only define those that are required to run the consensus algorithm. +type Governance interface { + // Get the current validator set and it's corresponding stake. + GetValidatorSet() map[types.ValidatorID]decimal.Decimal + + // Get K. + GetTotalOrderingK() int + + // Get PhiRatio. + GetPhiRatio() float32 + + // Get block proposing interval (in milliseconds). + GetBlockProposingInterval() int + + // Get Genesis CRS. + GetGenesisCRS() string + + // Get configuration change events after an epoch. + GetConfigurationChangeEvent(epoch int) []types.ConfigurationChangeEvent +} |