Use a constant for maximum surjection targets

This commit is contained in:
Andrew Chow 2021-06-17 18:47:24 -04:00
parent 4a44ff2c2e
commit 4940ceeea6
3 changed files with 4 additions and 2 deletions

View file

@ -192,7 +192,7 @@ bool SurjectOutput(CTxOutWitness& txoutwit, const std::vector<secp256k1_fixed_as
{
int ret;
// 1 to 3 targets
size_t nInputsToSelect = std::min((size_t)3, surjection_targets.size());
size_t nInputsToSelect = std::min(MAX_SURJECTION_TARGETS, surjection_targets.size());
unsigned char randseed[32];
GetStrongRandBytes(randseed, 32);
size_t input_index;

View file

@ -23,6 +23,8 @@ static const size_t MAX_RANGEPROOF_SIZE = 5126;
static const size_t DEFAULT_SURJECTIONPROOF_SIZE = 135;
// 32 bytes of asset type, 32 bytes of asset blinding factor in sidechannel
static const size_t SIDECHANNEL_MSG_SIZE = 64;
// Maximum number of inputs to select for surjection proof
static const size_t MAX_SURJECTION_TARGETS = 3;
// Blinding context
extern secp256k1_context* secp256k1_blind_context;

View file

@ -38,7 +38,7 @@ bool CreateAssetSurjectionProof(std::vector<unsigned char>& output_proof, const
{
int ret;
// 1 to 3 targets
size_t inputs_to_select = std::min((size_t)3, fixed_input_tags.size());
size_t inputs_to_select = std::min(MAX_SURJECTION_TARGETS, fixed_input_tags.size());
unsigned char randseed[32];
GetStrongRandBytes(randseed, 32);
size_t input_index;