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 21:32:49 +0800 |
commit | b67ef6594e03b45bb9e683631a7bf9584f6a3437 (patch) | |
tree | 8db22129f6bc45583c51a713516e392d59dadcd3 /core | |
parent | 3bbf9a8358bef8dc9924c8af7fc2ad0a91171d1d (diff) | |
download | go-tangerine-b67ef6594e03b45bb9e683631a7bf9584f6a3437.tar go-tangerine-b67ef6594e03b45bb9e683631a7bf9584f6a3437.tar.gz go-tangerine-b67ef6594e03b45bb9e683631a7bf9584f6a3437.tar.bz2 go-tangerine-b67ef6594e03b45bb9e683631a7bf9584f6a3437.tar.lz go-tangerine-b67ef6594e03b45bb9e683631a7bf9584f6a3437.tar.xz go-tangerine-b67ef6594e03b45bb9e683631a7bf9584f6a3437.tar.zst go-tangerine-b67ef6594e03b45bb9e683631a7bf9584f6a3437.zip |
core: vm: check if caller already staked when adding dkg mpk
Diffstat (limited to 'core')
-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() |