aboutsummaryrefslogtreecommitdiff
path: root/src/ringct/multiexp.cc
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-01-18 12:00:47 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-09-11 13:37:30 +0000
commit7f48bf05d7229112fb16373fc58e540cdae3b0d0 (patch)
tree45760afa0f3bcc1119ba256dfe217ac624d55bc5 /src/ringct/multiexp.cc
parentbulletproofs: add multi output bulletproofs to rct (diff)
downloadmonero-7f48bf05d7229112fb16373fc58e540cdae3b0d0.tar.xz
multiexp: bos coster now works for just one point
Diffstat (limited to 'src/ringct/multiexp.cc')
-rw-r--r--src/ringct/multiexp.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/ringct/multiexp.cc b/src/ringct/multiexp.cc
index b70d92d46..7ed9672f2 100644
--- a/src/ringct/multiexp.cc
+++ b/src/ringct/multiexp.cc
@@ -155,7 +155,7 @@ rct::key bos_coster_heap_conv_robust(std::vector<MultiexpData> data)
MULTIEXP_PERF(PERF_TIMER_START_UNIT(bos_coster, 1000000));
MULTIEXP_PERF(PERF_TIMER_START_UNIT(setup, 1000000));
size_t points = data.size();
- CHECK_AND_ASSERT_THROW_MES(points > 1, "Not enough points");
+ CHECK_AND_ASSERT_THROW_MES(points > 0, "Not enough points");
std::vector<size_t> heap;
heap.reserve(points);
for (size_t n = 0; n < points; ++n)
@@ -164,6 +164,16 @@ rct::key bos_coster_heap_conv_robust(std::vector<MultiexpData> data)
heap.push_back(n);
}
points = heap.size();
+ if (points == 0)
+ return rct::identity();
+ if (points < 2)
+ {
+ ge_p2 p2;
+ ge_scalarmult(&p2, data[0].scalar.bytes, &data[0].point);
+ rct::key res;
+ ge_tobytes(res.bytes, &p2);
+ return res;
+ }
auto Comp = [&](size_t e0, size_t e1) { return data[e0].scalar < data[e1].scalar; };
std::make_heap(heap.begin(), heap.end(), Comp);