Add header_hash and header_prevhash class methods
This commit is contained in:
parent
d4c871814f
commit
6b63ecb439
16
lib/coins.py
16
lib/coins.py
@ -214,6 +214,16 @@ class Coin(object):
|
|||||||
payload.append(0x01)
|
payload.append(0x01)
|
||||||
return Base58.encode_check(payload)
|
return Base58.encode_check(payload)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def header_hash(cls, header):
|
||||||
|
'''Given a header return hash'''
|
||||||
|
return double_sha256(header)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def header_prevhash(cls, header):
|
||||||
|
'''Given a header return previous hash'''
|
||||||
|
return header[4:36]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def header_hashes(cls, header):
|
def header_hashes(cls, header):
|
||||||
'''Given a header return the previous and current block hashes.'''
|
'''Given a header return the previous and current block hashes.'''
|
||||||
@ -367,6 +377,12 @@ class Dash(Coin):
|
|||||||
IRC_PREFIX = "D_"
|
IRC_PREFIX = "D_"
|
||||||
IRC_CHANNEL = "#electrum-dash"
|
IRC_CHANNEL = "#electrum-dash"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def header_hash(cls, header):
|
||||||
|
'''Given a header return the hash.'''
|
||||||
|
import x11_hash
|
||||||
|
return x11_hash.getPoWHash(header)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def header_hashes(cls, header):
|
def header_hashes(cls, header):
|
||||||
'''Given a header return the previous and current block hashes.'''
|
'''Given a header return the previous and current block hashes.'''
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user