Add a define for the max number of bulletproof multi-outputs

This commit is contained in:
moneromooo-monero 2018-03-30 20:44:51 +01:00
parent 2a8fcb421b
commit 7e67c52fa2
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
3 changed files with 5 additions and 2 deletions

View file

@ -141,6 +141,8 @@
#define DEFAULT_TXPOOL_MAX_SIZE 648000000ull // 3 days at 300000, in bytes #define DEFAULT_TXPOOL_MAX_SIZE 648000000ull // 3 days at 300000, in bytes
#define BULLETPROOF_MAX_OUTPUTS 16
// New constants are intended to go here // New constants are intended to go here
namespace config namespace config
{ {

View file

@ -33,6 +33,7 @@
#include <boost/thread/mutex.hpp> #include <boost/thread/mutex.hpp>
#include "misc_log_ex.h" #include "misc_log_ex.h"
#include "common/perf_timer.h" #include "common/perf_timer.h"
#include "cryptonote_config.h"
extern "C" extern "C"
{ {
#include "crypto/crypto-ops.h" #include "crypto/crypto-ops.h"
@ -57,7 +58,7 @@ static rct::keyV vector_dup(const rct::key &x, size_t n);
static rct::key inner_product(const rct::keyV &a, const rct::keyV &b); static rct::key inner_product(const rct::keyV &a, const rct::keyV &b);
static constexpr size_t maxN = 64; static constexpr size_t maxN = 64;
static constexpr size_t maxM = 16; static constexpr size_t maxM = BULLETPROOF_MAX_OUTPUTS;
static rct::key Hi[maxN*maxM], Gi[maxN*maxM]; static rct::key Hi[maxN*maxM], Gi[maxN*maxM];
static ge_p3 Hi_p3[maxN*maxM], Gi_p3[maxN*maxM]; static ge_p3 Hi_p3[maxN*maxM], Gi_p3[maxN*maxM];
static ge_dsmp Gprecomp[maxN*maxM], Hprecomp[maxN*maxM]; static ge_dsmp Gprecomp[maxN*maxM], Hprecomp[maxN*maxM];

View file

@ -762,7 +762,7 @@ namespace rct {
{ {
size_t batch_size = 1; size_t batch_size = 1;
if (range_proof_type == RangeProofMultiOutputBulletproof) if (range_proof_type == RangeProofMultiOutputBulletproof)
while (batch_size * 2 + amounts_proved <= n_amounts && batch_size * 2 <= 16) while (batch_size * 2 + amounts_proved <= n_amounts && batch_size * 2 <= BULLETPROOF_MAX_OUTPUTS)
batch_size *= 2; batch_size *= 2;
rct::keyV C, masks; rct::keyV C, masks;
std::vector<uint64_t> batch_amounts(batch_size); std::vector<uint64_t> batch_amounts(batch_size);