From edfa40eb691862154e7806ce8560d632bd82830b Mon Sep 17 00:00:00 2001
From: Steven Roose <steven@stevenroose.org>
Date: Tue, 24 Mar 2020 14:15:15 +0000
Subject: [PATCH] Remove the min(max( construction for the ct_exponent argument

We removed the similar construction for ct_bits in an earlier commit.
The construction is to keep the value between -1 and 18. This kind of
means that a user that inputs a value outside that range will not get an
error, but will use the value on the edge of the range instead.

It's probably better to return an error (generated by secp256k1) in the
case of invalid input.
---
 src/blind.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/blind.cpp b/src/blind.cpp
index f751f16133..0cb30a41c0 100644
--- a/src/blind.cpp
+++ b/src/blind.cpp
@@ -178,7 +178,7 @@ bool GenerateRangeproof(std::vector<unsigned char>& rangeproof, const std::vecto
     memcpy(asset_message+32, asset_blindptrs[asset_blindptrs.size()-1], 32);
 
     // Sign rangeproof
-    int ct_exponent = std::min(std::max((int)gArgs.GetArg("-ct_exponent", 0), -1), 18);
+    int ct_exponent = (int)gArgs.GetArg("-ct_exponent", 0);
     int ct_bits = (int)gArgs.GetArg("-ct_bits", 52);
     // If min_value is 0, scriptPubKey must be unspendable
     uint64_t min_value = scriptPubKey.IsUnspendable() ? 0 : 1;