diff --git a/src/libspark/schnorr.cpp b/src/libspark/schnorr.cpp index 353bfbc88c..4657fece77 100644 --- a/src/libspark/schnorr.cpp +++ b/src/libspark/schnorr.cpp @@ -47,6 +47,10 @@ void Schnorr::prove(const std::vector& y, const std::vector& Y, const SchnorrProof& pro const Scalar c = challenge(Y, proof.A); Scalar c_power(c); for (std::size_t i = 0; i < n; i++) { + if (c_power.isZero()) { + throw std::invalid_argument("Unexpected challenge!"); + } + points.emplace_back(Y[i]); scalars.emplace_back(c_power); c_power *= c;