Fix crash when ecdsa package not installed
This commit is contained in:
parent
19c18e1728
commit
d55e2d379a
22
pywallet.py
22
pywallet.py
@ -37,12 +37,6 @@ from datetime import datetime
|
|||||||
from subprocess import *
|
from subprocess import *
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
import ecdsa
|
|
||||||
from ecdsa import der
|
|
||||||
except:
|
|
||||||
missing_dep.append('ecdsa')
|
|
||||||
|
|
||||||
max_version = 32500
|
max_version = 32500
|
||||||
addrtype = 0
|
addrtype = 0
|
||||||
json_db = {}
|
json_db = {}
|
||||||
@ -78,11 +72,16 @@ _a = 0x0000000000000000000000000000000000000000000000000000000000000000L
|
|||||||
_Gx = 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798L
|
_Gx = 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798L
|
||||||
_Gy = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8L
|
_Gy = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8L
|
||||||
|
|
||||||
curve_secp256k1 = ecdsa.ellipticcurve.CurveFp (_p, _a, _b)
|
try:
|
||||||
generator_secp256k1 = g = ecdsa.ellipticcurve.Point (curve_secp256k1, _Gx, _Gy, _r)
|
import ecdsa
|
||||||
randrange = random.SystemRandom().randrange
|
from ecdsa import der
|
||||||
secp256k1 = ecdsa.curves.Curve ( "secp256k1", curve_secp256k1, generator_secp256k1, (1, 3, 132, 0, 10) )
|
curve_secp256k1 = ecdsa.ellipticcurve.CurveFp (_p, _a, _b)
|
||||||
ecdsa.curves.curves.append (secp256k1)
|
generator_secp256k1 = g = ecdsa.ellipticcurve.Point (curve_secp256k1, _Gx, _Gy, _r)
|
||||||
|
randrange = random.SystemRandom().randrange
|
||||||
|
secp256k1 = ecdsa.curves.Curve ( "secp256k1", curve_secp256k1, generator_secp256k1, (1, 3, 132, 0, 10) )
|
||||||
|
ecdsa.curves.curves.append (secp256k1)
|
||||||
|
except:
|
||||||
|
missing_dep.append('ecdsa')
|
||||||
|
|
||||||
class CurveFp( object ):
|
class CurveFp( object ):
|
||||||
def __init__( self, p, a, b ):
|
def __init__( self, p, a, b ):
|
||||||
@ -1650,3 +1649,4 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
db.close()
|
db.close()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user