Skip to content

Commit

Permalink
add with draw constraint (#855)
Browse files Browse the repository at this point in the history
  • Loading branch information
siovanus authored and laizy committed Apr 22, 2019
1 parent 4af17dc commit c46ec1f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions smartcontract/service/native/governance/governance.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@ const (
GAS_ADDRESS = "gasAddress"

//global
PRECISE = 1000000
NEW_VERSION_VIEW = 6
NEW_VERSION_BLOCK = 414100
PRECISE = 1000000
NEW_VERSION_VIEW = 6
NEW_VERSION_BLOCK = 414100
NEW_WITHDRAW_BLOCK = 2800000
)

// candidate fee must >= 1 ONG
Expand Down Expand Up @@ -927,6 +928,11 @@ func Withdraw(native *native.NativeService) ([]byte, error) {
peerPubkey := params.PeerPubkeyList[i]
pos := params.WithdrawList[i]

if native.Height > NEW_WITHDRAW_BLOCK {
if pos < 1 {
return utils.BYTE_FALSE, fmt.Errorf("withdraw, amount of withdraw must >= 1")
}
}
peerPubkeyPrefix, err := hex.DecodeString(peerPubkey)
if err != nil {
return utils.BYTE_FALSE, fmt.Errorf("hex.DecodeString, peerPubkey format error: %v", err)
Expand Down

0 comments on commit c46ec1f

Please sign in to comment.