diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-10-08 13:46:48 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-03-12 12:19:09 +0800 |
commit | b18f0e4a8c648ac81488e0638e39199760c32c76 (patch) | |
tree | e367a1725e203719d2a92a35259eef6c8c3ca33b /core/vm | |
parent | c3eb35a4be096fdad703252a1175bf6bcb8a4329 (diff) | |
download | dexon-b18f0e4a8c648ac81488e0638e39199760c32c76.tar dexon-b18f0e4a8c648ac81488e0638e39199760c32c76.tar.gz dexon-b18f0e4a8c648ac81488e0638e39199760c32c76.tar.bz2 dexon-b18f0e4a8c648ac81488e0638e39199760c32c76.tar.lz dexon-b18f0e4a8c648ac81488e0638e39199760c32c76.tar.xz dexon-b18f0e4a8c648ac81488e0638e39199760c32c76.tar.zst dexon-b18f0e4a8c648ac81488e0638e39199760c32c76.zip |
core: vm: check if caller already staked when adding dkg mpk
Diffstat (limited to 'core/vm')
-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() |