Skip to content

Commit e87b390

Browse files
committed
Some readability improvements in blind.cpp
1 parent 26e5490 commit e87b390

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/blind.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,11 @@ bool GenerateRangeproof(std::vector<unsigned char>& rangeproof, const std::vecto
178178
memcpy(asset_message+32, asset_blindptrs[asset_blindptrs.size()-1], 32);
179179

180180
// Sign rangeproof
181+
int ct_exponent = std::min(std::max((int)gArgs.GetArg("-ct_exponent", 0), -1), 18);
182+
int ct_bits = (int)gArgs.GetArg("-ct_bits", 52);
181183
// If min_value is 0, scriptPubKey must be unspendable
182-
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);
184+
uint64_t min_value = scriptPubKey.IsUnspendable() ? 0 : 1;
185+
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);
183186
rangeproof.resize(nRangeProofLen);
184187
return (res == 1);
185188
}

0 commit comments

Comments
 (0)