aboutsummaryrefslogtreecommitdiffstats
path: root/consensus/dexcon/dexcon_test.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2019-03-20 11:55:01 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-13 18:11:44 +0800
commita7d069aae1a4bc237a9a3a0f10efeba77c473bcb (patch)
tree74a2138655ed6e47ed77f8cb16a7f9d2a6613ec1 /consensus/dexcon/dexcon_test.go
parent2e9584d1d6690de6a4fa1ee6da6f988b2d746681 (diff)
downloadgo-tangerine-a7d069aae1a4bc237a9a3a0f10efeba77c473bcb.tar
go-tangerine-a7d069aae1a4bc237a9a3a0f10efeba77c473bcb.tar.gz
go-tangerine-a7d069aae1a4bc237a9a3a0f10efeba77c473bcb.tar.bz2
go-tangerine-a7d069aae1a4bc237a9a3a0f10efeba77c473bcb.tar.lz
go-tangerine-a7d069aae1a4bc237a9a3a0f10efeba77c473bcb.tar.xz
go-tangerine-a7d069aae1a4bc237a9a3a0f10efeba77c473bcb.tar.zst
go-tangerine-a7d069aae1a4bc237a9a3a0f10efeba77c473bcb.zip
consensus: dexcon: disqualify dead node (#280)
Since a qualified node might fail stopped, we need to remove them from qualified nodes to maintain network integrity. We do this by inspect the previous round to see if there are dead nodes. A dead node is a notary set node that does not propose any block in the previous round. We disqualify them by fining them so their staked value is 1 wei below minStake. This make them unqualified for being notary set in the follow on rounds.
Diffstat (limited to 'consensus/dexcon/dexcon_test.go')
-rw-r--r--consensus/dexcon/dexcon_test.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/consensus/dexcon/dexcon_test.go b/consensus/dexcon/dexcon_test.go
index f34823570..0181a80f3 100644
--- a/consensus/dexcon/dexcon_test.go
+++ b/consensus/dexcon/dexcon_test.go
@@ -31,14 +31,18 @@ import (
"github.com/dexon-foundation/dexon/params"
)
-type GovStateFetcher struct {
+type govStateFetcher struct {
statedb *state.StateDB
}
-func (g *GovStateFetcher) GetStateForConfigAtRound(_ uint64) *vm.GovernanceState {
+func (g *govStateFetcher) GetStateForConfigAtRound(_ uint64) *vm.GovernanceState {
return &vm.GovernanceState{g.statedb}
}
+func (g *govStateFetcher) NotarySetNodeKeyAddresses(round uint64) (map[common.Address]struct{}, error) {
+ return make(map[common.Address]struct{}), nil
+}
+
type DexconTestSuite struct {
suite.Suite
@@ -86,7 +90,7 @@ func (d *DexconTestSuite) SetupTest() {
func (d *DexconTestSuite) TestBlockRewardCalculation() {
consensus := New()
- consensus.SetGovStateFetcher(&GovStateFetcher{d.stateDB})
+ consensus.SetGovStateFetcher(&govStateFetcher{d.stateDB})
d.s.IncTotalStaked(big.NewInt(1e18))