Skip to content

Commit

Permalink
Allow mint limit to be zero (#1576)
Browse files Browse the repository at this point in the history
  • Loading branch information
shohamc1 authored Nov 17, 2022
1 parent 7ce2d17 commit 3a65f45
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/masternodes/govvariables/attributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ ResVal<CAttributeValue> VerifyPositiveFloat(const std::string& str) {

ResVal<CAttributeValue> VerifyPositiveOrMinusOneFloat(const std::string& str) {
CAmount amount = 0;
if (!ParseFixedPoint(str, 8, &amount) || !(amount > 0 || amount == -1 * COIN)) {
if (!ParseFixedPoint(str, 8, &amount) || !(amount >= 0 || amount == -1 * COIN)) {
return Res::Err("Amount must be positive or -1");
}

Expand Down
4 changes: 2 additions & 2 deletions test/functional/feature_consortium.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ def run_test(self):
assert_raises_rpc_error(-32600, "You are not a foundation member or token owner and cannot mint this token", self.nodes[3].minttokens, ["1@" + symbolBTC])

# Set global mint limits
self.nodes[0].setgov({"ATTRIBUTES": {'v0/consortium/' + idBTC + '/mint_limit': '0',
'v0/consortium/' + idBTC + '/mint_limit_daily': '0'}})
self.nodes[0].setgov({"ATTRIBUTES":{'v0/consortium/' + idBTC + '/mint_limit' : '10', 'v0/consortium/' + idBTC + '/mint_limit_daily' : '10'}})
self.nodes[0].generate(1)
self.sync_blocks()
Expand Down Expand Up @@ -512,8 +514,6 @@ def run_test(self):
# Throw error for invalid values
assert_raises_rpc_error(-5, "Amount must be positive or -1", self.nodes[0].setgov, {
"ATTRIBUTES": {'v0/consortium/' + idBTC + '/mint_limit': '-2'}})
assert_raises_rpc_error(-5, "Amount must be positive or -1", self.nodes[0].setgov, {
"ATTRIBUTES": {'v0/consortium/' + idBTC + '/mint_limit': '0'}})

if __name__ == '__main__':
ConsortiumTest().main()

0 comments on commit 3a65f45

Please sign in to comment.