Skip to content

Commit 1065daa

Browse files
committed
Fix min branch blinds behavior
1 parent 8870f25 commit 1065daa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/fcmp_pp/blinds_cache.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
#include "prove.h"
3232

33+
#include <algorithm>
34+
3335

3436
namespace fcmp_pp
3537
{
@@ -67,7 +69,8 @@ static bool need_more_c1_blinds(const std::size_t prepare_n_min_inputs,
6769
const uint8_t n_tree_layers,
6870
const std::size_t n_c1_branch_blinds)
6971
{
70-
const std::size_t n_needed = (prepare_n_min_inputs + n_inputs) * n_c1_branch_blinds_needed_per_input(n_tree_layers);
72+
const std::size_t n_inputs_needed = std::max(prepare_n_min_inputs, n_inputs);
73+
const std::size_t n_needed = n_inputs_needed * n_c1_branch_blinds_needed_per_input(n_tree_layers);
7174
return n_c1_branch_blinds < n_needed;
7275
}
7376
//----------------------------------------------------------------------------------------------------------------------
@@ -76,7 +79,8 @@ static bool need_more_c2_blinds(const std::size_t prepare_n_min_inputs,
7679
const uint8_t n_tree_layers,
7780
const std::size_t n_c2_branch_blinds)
7881
{
79-
const std::size_t n_needed = (prepare_n_min_inputs + n_inputs) * n_c2_branch_blinds_needed_per_input(n_tree_layers);
82+
const std::size_t n_inputs_needed = std::max(prepare_n_min_inputs, n_inputs);
83+
const std::size_t n_needed = n_inputs_needed * n_c2_branch_blinds_needed_per_input(n_tree_layers);
8084
return n_c2_branch_blinds < n_needed;
8185
}
8286
//----------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)