aboutsummaryrefslogtreecommitdiffstats
path: root/core/genesis.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2019-03-11 15:47:29 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:57 +0800
commit22325afbf6dfd179f074018fab4866a0c56a3e6a (patch)
tree9cffb79b5265351ee64d6631ae933224119ec33a /core/genesis.go
parentabcb28c8854c74942dd731f971dff2128fe0084f (diff)
downloaddexon-22325afbf6dfd179f074018fab4866a0c56a3e6a.tar
dexon-22325afbf6dfd179f074018fab4866a0c56a3e6a.tar.gz
dexon-22325afbf6dfd179f074018fab4866a0c56a3e6a.tar.bz2
dexon-22325afbf6dfd179f074018fab4866a0c56a3e6a.tar.lz
dexon-22325afbf6dfd179f074018fab4866a0c56a3e6a.tar.xz
dexon-22325afbf6dfd179f074018fab4866a0c56a3e6a.tar.zst
dexon-22325afbf6dfd179f074018fab4866a0c56a3e6a.zip
core: vm: remove delegation mechanism (#245)
The current delegation mechanism are prone to unstaking attack. i.e. a malicious attacker could unstake a small amount from a lot of node it staked before and make them unqualified, which leads to potential failure of the network. Since DEXON does not use consensus like DPoS, node is required to have at least MinStake in order to become a node. Voting mechanism is not required in our system since qualified node does not depends on the number of votes. Instead of managing the delegation mechanism in governance contract, we should let the owner manage the delegation and reward distribution mechanism on their own.
Diffstat (limited to 'core/genesis.go')
-rw-r--r--core/genesis.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/genesis.go b/core/genesis.go
index f6935830c..7f2cafbf5 100644
--- a/core/genesis.go
+++ b/core/genesis.go
@@ -302,9 +302,10 @@ func (g *Genesis) ToBlock(db ethdb.Database) *types.Block {
for _, addr := range keys {
account := g.Alloc[addr]
if account.Staked.Cmp(big.NewInt(0)) > 0 {
- govStateHelper.Stake(addr, account.PublicKey, account.Staked,
+ govStateHelper.Register(addr, account.PublicKey,
account.NodeInfo.Name, account.NodeInfo.Email,
- account.NodeInfo.Location, account.NodeInfo.Url)
+ account.NodeInfo.Location, account.NodeInfo.Url,
+ account.Staked)
}
}