Skip to content

Commit

Permalink
[test] Add ECKey.as_int() and ECKey.from_int() methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jnewbery committed Sep 17, 2019
1 parent 18a2613 commit 2859e5c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/functional/test_framework/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,15 @@ def get_bytes(self):
assert(self.valid)
return self.secret.to_bytes(32, 'big')

def as_int(self):
return self.secret

def from_int(self, secret, compressed=True):
self.valid = (secret > 0 and secret < SECP256K1_ORDER)
if self.valid:
self.secret = secret
self.compressed = compressed

def __add__(self, other):
"""Add key secrets. Returns compressed key."""
assert isinstance(other, ECKey)
Expand Down

0 comments on commit 2859e5c

Please sign in to comment.