From a7d069aae1a4bc237a9a3a0f10efeba77c473bcb Mon Sep 17 00:00:00 2001 From: Wei-Ning Huang Date: Wed, 20 Mar 2019 11:55:01 +0800 Subject: 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. --- dex/app_test.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'dex/app_test.go') diff --git a/dex/app_test.go b/dex/app_test.go index 7b158dd9e..e648abdbd 100644 --- a/dex/app_test.go +++ b/dex/app_test.go @@ -2299,12 +2299,10 @@ func newDexon(masterKey *ecdsa.PrivateKey, accountNum int) (*Dexon, []*ecdsa.Pri db := ethdb.NewMemDatabase() genesis := core.DefaultTestnetGenesisBlock() - genesis.Alloc = core.GenesisAlloc{ - crypto.PubkeyToAddress(masterKey.PublicKey): { - Balance: big.NewInt(100000000000000000), - Staked: big.NewInt(50000000000000000), - PublicKey: crypto.FromECDSAPub(&masterKey.PublicKey), - }, + genesis.Alloc[crypto.PubkeyToAddress(masterKey.PublicKey)] = core.GenesisAccount{ + Balance: big.NewInt(100000000000000000), + Staked: big.NewInt(50000000000000000), + PublicKey: crypto.FromECDSAPub(&masterKey.PublicKey), } var accounts []*ecdsa.PrivateKey @@ -2322,7 +2320,7 @@ func newDexon(masterKey *ecdsa.PrivateKey, accountNum int) (*Dexon, []*ecdsa.Pri } genesis.Config.Dexcon.BlockGasLimit = 2000000 - genesis.Config.Dexcon.RoundLength = 60 + genesis.Config.Dexcon.RoundLength = 600 genesis.Config.Dexcon.Owner = crypto.PubkeyToAddress(masterKey.PublicKey) chainConfig, _, err := core.SetupGenesisBlock(db, genesis) -- cgit v1.2.3