diff options
Diffstat (limited to 'core/vm/oracle_contracts.go')
-rw-r--r-- | core/vm/oracle_contracts.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/core/vm/oracle_contracts.go b/core/vm/oracle_contracts.go index b9525e00b..f999cc6b1 100644 --- a/core/vm/oracle_contracts.go +++ b/core/vm/oracle_contracts.go @@ -1597,7 +1597,19 @@ func (g *GovernanceContract) register( value := g.contract.Value() offset := g.state.NodesOffsetByAddress(caller) - // Can not stake if already staked. + // Can not register if already registered. + if offset.Cmp(big.NewInt(0)) >= 0 { + return nil, errExecutionReverted + } + + nodeKeyAddr, err := publicKeyToNodeKeyAddress(publicKey) + if err != nil { + return nil, errExecutionReverted + } + + offset = g.state.NodesOffsetByNodeKeyAddress(nodeKeyAddr) + + // Can not register if node key is duplicate. if offset.Cmp(big.NewInt(0)) >= 0 { return nil, errExecutionReverted } |