From 3a65f4571b7caef5dea3c74315ebcf0fb55cebb8 Mon Sep 17 00:00:00 2001 From: Shoham Chakraborty Date: Thu, 17 Nov 2022 17:01:33 +0800 Subject: [PATCH] Allow mint limit to be zero (#1576) --- src/masternodes/govvariables/attributes.cpp | 2 +- test/functional/feature_consortium.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/masternodes/govvariables/attributes.cpp b/src/masternodes/govvariables/attributes.cpp index 42d873430c8..e4d31e36dc8 100644 --- a/src/masternodes/govvariables/attributes.cpp +++ b/src/masternodes/govvariables/attributes.cpp @@ -365,7 +365,7 @@ ResVal VerifyPositiveFloat(const std::string& str) { ResVal 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"); } diff --git a/test/functional/feature_consortium.py b/test/functional/feature_consortium.py index e6f193e2546..4877557820c 100755 --- a/test/functional/feature_consortium.py +++ b/test/functional/feature_consortium.py @@ -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() @@ -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()