Skip to content

Commit

Permalink
Add Bitgesell (BGL) - check pycodestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-emma committed Sep 29, 2024
1 parent 413717a commit 19cfc72
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
15 changes: 3 additions & 12 deletions electrumx/lib/coins.py
Original file line number Diff line number Diff line change
Expand Up @@ -4249,27 +4249,18 @@ class Bitgesell(Coin):
XPUB_VERBYTES = bytes.fromhex("0488b21e")
XPRV_VERBYTES = bytes.fromhex("0488ade4")
RPC_PORT = 8332
GENESIS_HASH = (
'00000018cdcfeeb4dfdebe9392b855cfea7d6ddb953ef13f974b58773606d53d')
PEERS = [
]


GENESIS_HASH = ('00000018cdcfeeb4dfdebe9392b855cfea7d6ddb953ef13f974b58773606d53d')
PEERS = []
DESERIALIZER = lib_tx.DeserializerSegWitBGL

MEMPOOL_HISTOGRAM_REFRESH_SECS = 120
TX_COUNT = 14731600
TX_COUNT_HEIGHT = 228495
TX_PER_BLOCK = 64



P2PKH_VERBYTE = bytes.fromhex("0a")
P2SH_VERBYTES = (bytes.fromhex("19"),)
WIF_BYTE = bytes.fromhex("80")


@classmethod
def header_hash(cls, header):
'''Given a header return hash'''
return keccak_256(header)
return keccak_256(header)
2 changes: 2 additions & 0 deletions electrumx/lib/hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ def double_sha256(x):
'''SHA-256 of SHA-256, as used extensively in bitcoin.'''
return sha256(sha256(x))


def keccak_256(s):
from Cryptodome.Hash import keccak
keccak_hash = keccak.new(data=s, digest_bits=256)
return keccak_hash.digest()


def hash_to_hex_str(x):
'''Convert a big-endian binary hash to displayed hex string.
Expand Down
2 changes: 2 additions & 0 deletions electrumx/lib/tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,11 @@ def read_tx_and_vsize(self):
tx, _tx_hash, vsize = self._read_tx_parts()
return tx, vsize


class DeserializerSegWitBGL(DeserializerSegWit):
TX_HASH_FN = staticmethod(sha256)


class DeserializerLitecoin(DeserializerSegWit):
'''Class representing Litecoin transactions, which may have the MW flag set.
Expand Down

0 comments on commit 19cfc72

Please sign in to comment.