Fix bug where we were generating too many nonces (#4805)

This commit is contained in:
Chris Stewart 2022-09-27 12:01:43 -05:00 committed by GitHub
parent 8d91abd678
commit ecf2d2ba2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -280,7 +280,7 @@ object ECPrivateKey extends Factory[ECPrivateKey] {
/** Generates [[num]] private keys that are ordered by [[ECPrivateKey.schnorrNonce]] */
def generateNonceOrderedPrivKeys(num: Int): Vector[ECPrivateKey] = {
val privKeys = 0.to(num).map(_ => ECPrivateKey.freshPrivateKey).toVector
val privKeys = 0.until(num).map(_ => ECPrivateKey.freshPrivateKey).toVector
val sortByNonce = privKeys
.map(p => (p, p.schnorrNonce))
.sortBy(_._2)(CryptoOrdering.nonceOrdering)