diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-10-08 13:46:48 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:23:38 +0800 |
commit | 611a560ab953a8dcb73dee465a26bc110a56a1db (patch) | |
tree | fa86605dc9b9680b9b4c07b4d2ff2814f43e40e5 | |
parent | aa1cac0063ca50567c981f31017cf6cdef9249f3 (diff) | |
download | go-tangerine-611a560ab953a8dcb73dee465a26bc110a56a1db.tar go-tangerine-611a560ab953a8dcb73dee465a26bc110a56a1db.tar.gz go-tangerine-611a560ab953a8dcb73dee465a26bc110a56a1db.tar.bz2 go-tangerine-611a560ab953a8dcb73dee465a26bc110a56a1db.tar.lz go-tangerine-611a560ab953a8dcb73dee465a26bc110a56a1db.tar.xz go-tangerine-611a560ab953a8dcb73dee465a26bc110a56a1db.tar.zst go-tangerine-611a560ab953a8dcb73dee465a26bc110a56a1db.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() |