aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/governance.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@cobinhood.com>2018-10-13 15:22:08 +0800
committerWei-Ning Huang <w@dexon.org>2018-12-19 20:54:27 +0800
commitfdd1b2900392b4ecf089b89d88b563430e18d4b0 (patch)
tree91a70e91c003d1dbffbcfa3f2dc8232322fce3f3 /core/vm/governance.go
parente808bc4a27ce8aa8bdb3f085b3d944d3543e118c (diff)
downloaddexon-fdd1b2900392b4ecf089b89d88b563430e18d4b0.tar
dexon-fdd1b2900392b4ecf089b89d88b563430e18d4b0.tar.gz
dexon-fdd1b2900392b4ecf089b89d88b563430e18d4b0.tar.bz2
dexon-fdd1b2900392b4ecf089b89d88b563430e18d4b0.tar.lz
dexon-fdd1b2900392b4ecf089b89d88b563430e18d4b0.tar.xz
dexon-fdd1b2900392b4ecf089b89d88b563430e18d4b0.tar.zst
dexon-fdd1b2900392b4ecf089b89d88b563430e18d4b0.zip
dex: implement sendTx related governance methods
Diffstat (limited to 'core/vm/governance.go')
-rw-r--r--core/vm/governance.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/vm/governance.go b/core/vm/governance.go
index f5660a92e..5bbb5a1ec 100644
--- a/core/vm/governance.go
+++ b/core/vm/governance.go
@@ -549,6 +549,7 @@ const abiJSON = `
`
var abiObject abi.ABI
+var GovernanceContractName2Method map[string]abi.Method
var sig2Method map[string]abi.Method
var events map[string]abi.Event
@@ -560,10 +561,12 @@ func init() {
}
sig2Method = make(map[string]abi.Method)
+ GovernanceContractName2Method = make(map[string]abi.Method)
// Construct dispatch table.
for _, method := range abiObject.Methods {
sig2Method[string(method.Id())] = method
+ GovernanceContractName2Method[method.Name] = method
}
events = make(map[string]abi.Event)
@@ -1564,9 +1567,11 @@ func (g *GovernanceContract) snapshotRound(round, height *big.Int) ([]byte, erro
// Only allow updating the next round.
nextRound := g.state.LenRoundHeight()
if round.Cmp(nextRound) != 0 {
+ g.penalize()
return nil, errExecutionReverted
}
g.state.PushRoundHeight(height)
+ g.contract.UseGas(100000)
return nil, nil
}