Page MenuHomePhabricator

[electrum] fix the max value for the ephemeral exponent
ClosedPublic

Authored by PiRK on Aug 23 2024, 19:49.

Details

Summary

A private key cannot be more than the curve's order, so don't risk generating a random number that will be an invalid key.

Setting the proper upper bound makes it unneccessary to then test that the point is valid and potentially raise an error. We should have at the very least retried in a loop until the rand integer is in the correct range.

Depends on D16677

Test Plan

python test_runner.py

(just to check this trivial fix does not introduce a typo or a syntax error)

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable