added difficulty property for ease of use

This commit is contained in:
Kjistóf 2017-12-02 00:22:33 +01:00
parent d1244f8b00
commit 2301264fdd
1 changed files with 5 additions and 0 deletions

View File

@ -8,7 +8,12 @@ class pow_base:
def base(self):
return self._base
@property
def difficulty(self):
return self._difficulty
def __init__(self, difficulty, base=None):
self._difficulty = difficulty
self._base = urandom(self._bits//8) if not base else base
self._target = 2 ** (self._bits - difficulty)