diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-10-08 13:46:48 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 13:49:52 +0800 |
commit | 9de083904ae109fa4de0f90791965555ef05ae1e (patch) | |
tree | 1a21aa6a3860ba76161dde3482676c5c0a0b3f76 | |
parent | ded365703a159e0f22a2c25a9b5e5791cdc43886 (diff) | |
download | dexon-9de083904ae109fa4de0f90791965555ef05ae1e.tar dexon-9de083904ae109fa4de0f90791965555ef05ae1e.tar.gz dexon-9de083904ae109fa4de0f90791965555ef05ae1e.tar.bz2 dexon-9de083904ae109fa4de0f90791965555ef05ae1e.tar.lz dexon-9de083904ae109fa4de0f90791965555ef05ae1e.tar.xz dexon-9de083904ae109fa4de0f90791965555ef05ae1e.tar.zst dexon-9de083904ae109fa4de0f90791965555ef05ae1e.zip |
core: vm: check if caller already staked when adding dkg mpk
-rw-r--r-- | core/vm/governance.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/vm/governance.go b/core/vm/governance.go index c75102f79..652d86357 100644 --- a/core/vm/governance.go +++ b/core/vm/governance.go @@ -904,6 +904,13 @@ func (g *GovernanceContract) proposeCRS(round *big.Int, signedCRS []byte) ([]byt } func (g *GovernanceContract) addDKGMasterPublicKey(round *big.Int, pk []byte) ([]byte, error) { + caller := g.contract.Caller() + offset := g.state.offset(caller) + // Can not add dkg mpk if not staked. + if offset.Cmp(big.NewInt(0)) < 0 { + return nil, errExecutionReverted + } + var dkgMasterPK types.DKGMasterPublicKey if err := rlp.DecodeBytes(pk, &dkgMasterPK); err != nil { g.penalize() |