From 48235ea40f6ab68b65228f914f885ed01437a0e3 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Mon, 16 Mar 2020 17:45:30 +0000 Subject: [PATCH] Some readability improvements in blind.cpp --- src/blind.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/blind.cpp b/src/blind.cpp index aec09e330ec..0cae54d66e9 100644 --- a/src/blind.cpp +++ b/src/blind.cpp @@ -178,8 +178,11 @@ bool GenerateRangeproof(std::vector& 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_bits = (int)gArgs.GetArg("-ct_bits", 51); // If min_value is 0, scriptPubKey must be unspendable - int res = secp256k1_rangeproof_sign(secp256k1_blind_context, rangeproof.data(), &nRangeProofLen, scriptPubKey.IsUnspendable() ? 0 : 1, &value_commit, value_blindptrs.back(), nonce.begin(), std::min(std::max((int)gArgs.GetArg("-ct_exponent", 0), -1),18), (int)gArgs.GetArg("-ct_bits", 51), amount, asset_message, sizeof(asset_message), scriptPubKey.size() ? &scriptPubKey.front() : NULL, scriptPubKey.size(), &gen); + uint64_t min_value = scriptPubKey.IsUnspendable() ? 0 : 1; + int res = secp256k1_rangeproof_sign(secp256k1_blind_context, rangeproof.data(), &nRangeProofLen, min_value, &value_commit, value_blindptrs.back(), nonce.begin(), ct_exponent, ct_bits, amount, asset_message, sizeof(asset_message), scriptPubKey.size() ? &scriptPubKey.front() : NULL, scriptPubKey.size(), &gen); rangeproof.resize(nRangeProofLen); return (res == 1); }