aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-04-18 14:06:25 +0200
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-04-21 10:19:04 +0200
commitfa6eb6516727a8675dc6e46634d8343e282528ab (patch)
treed5145a157beddf73b34216e4b0ec45ef18c1a94c /test/functional
parent88881cf7ac029aea660c2413ca8e2a5136fcd41b (diff)
downloadbitcoin-fa6eb6516727a8675dc6e46634d8343e282528ab.tar.xz
test: Use python3.8 pow()
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/test_framework/util.py13
1 files changed, 1 insertions, 12 deletions
diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py
index a1b90860f6..5eeb67c00a 100644
--- a/test/functional/test_framework/util.py
+++ b/test/functional/test_framework/util.py
@@ -542,18 +542,7 @@ def modinv(a, n):
"""Compute the modular inverse of a modulo n using the extended Euclidean
Algorithm. See https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm#Modular_integers.
"""
- # TODO: Change to pow(a, -1, n) available in Python 3.8
- t1, t2 = 0, 1
- r1, r2 = n, a
- while r2 != 0:
- q = r1 // r2
- t1, t2 = t2, t1 - q * t2
- r1, r2 = r2, r1 - q * r2
- if r1 > 1:
- return None
- if t1 < 0:
- t1 += n
- return t1
+ return pow(a, -1, n)
class TestFrameworkUtil(unittest.TestCase):
def test_modinv(self):