From 0f4f51d932d6afb5aa119ce9d5ae142fad75fe31 Mon Sep 17 00:00:00 2001 From: wilsonmeier Date: Tue, 13 Mar 2018 02:41:04 +0100 Subject: [PATCH] Changes for BTG (#409) * Implemented electrum_header for BTG to include solution (needed for validation on clientside) Add RPC_PORT for BTG node * Added node regtest compatibility * Updated unittests * Changed chunksize and regtest rpc port * Changed bits transfer format to decimal * Add testnet v3 params and corrected coin name --- lib/coins.py | 55 +++++++++++++++++++++++++++++++++---- tests/lib/test_addresses.py | 6 +++- tests/server/test_env.py | 10 +++++++ 3 files changed, 65 insertions(+), 6 deletions(-) diff --git a/lib/coins.py b/lib/coins.py index 3c32936..a5024b9 100644 --- a/lib/coins.py +++ b/lib/coins.py @@ -440,6 +440,7 @@ class BitcoinSegwit(BitcoinMixin, Coin): class BitcoinGold(EquihashMixin, BitcoinMixin, Coin): + CHUNK_SIZE = 252 NAME = "BitcoinGold" SHORTNAME = "BTG" FORK_HEIGHT = 491407 @@ -450,6 +451,7 @@ class BitcoinGold(EquihashMixin, BitcoinMixin, Coin): TX_COUNT_HEIGHT = 499923 TX_PER_BLOCK = 50 REORG_LIMIT = 1000 + RPC_PORT = 8338 @classmethod def header_hash(cls, header): @@ -461,6 +463,54 @@ class BitcoinGold(EquihashMixin, BitcoinMixin, Coin): else: return double_sha256(header[:68] + header[100:112]) + @classmethod + def electrum_header(cls, header, height): + h = dict( + block_height=height, + version=struct.unpack('