Move bitcoin-specific coin defaults to Bitcoin
This commit is contained in:
parent
198fe298b7
commit
59733e4609
19
lib/coins.py
19
lib/coins.py
@ -34,14 +34,10 @@ class Coin(object):
|
|||||||
REORG_LIMIT=200
|
REORG_LIMIT=200
|
||||||
# Not sure if these are coin-specific
|
# Not sure if these are coin-specific
|
||||||
HEADER_LEN = 80
|
HEADER_LEN = 80
|
||||||
DEFAULT_RPC_PORT = 8332
|
|
||||||
RPC_URL_REGEX = re.compile('.+@[^:]+(:[0-9]+)?')
|
RPC_URL_REGEX = re.compile('.+@[^:]+(:[0-9]+)?')
|
||||||
VALUE_PER_COIN = 100000000
|
VALUE_PER_COIN = 100000000
|
||||||
CHUNK_SIZE=2016
|
CHUNK_SIZE=2016
|
||||||
STRANGE_VERBYTE = 0xff
|
STRANGE_VERBYTE = 0xff
|
||||||
# IRC Defaults
|
|
||||||
IRC_PREFIX = "E_"
|
|
||||||
IRC_CHANNEL = "#electrum"
|
|
||||||
IRC_SERVER = "irc.freenode.net"
|
IRC_SERVER = "irc.freenode.net"
|
||||||
IRC_PORT = 6667
|
IRC_PORT = 6667
|
||||||
|
|
||||||
@ -65,7 +61,7 @@ class Coin(object):
|
|||||||
if not match:
|
if not match:
|
||||||
raise CoinError('invalid daemon URL: "{}"'.format(url))
|
raise CoinError('invalid daemon URL: "{}"'.format(url))
|
||||||
if match.groups()[0] is None:
|
if match.groups()[0] is None:
|
||||||
url += ':{:d}'.format(cls.DEFAULT_RPC_PORT)
|
url += ':{:d}'.format(cls.RPC_PORT)
|
||||||
if not url.startswith('http://'):
|
if not url.startswith('http://'):
|
||||||
url = 'http://' + url
|
url = 'http://' + url
|
||||||
return url + '/'
|
return url + '/'
|
||||||
@ -269,18 +265,20 @@ class Bitcoin(Coin):
|
|||||||
TX_COUNT = 142791895
|
TX_COUNT = 142791895
|
||||||
TX_COUNT_HEIGHT = 420976
|
TX_COUNT_HEIGHT = 420976
|
||||||
TX_PER_BLOCK = 1600
|
TX_PER_BLOCK = 1600
|
||||||
|
IRC_PREFIX = "E_"
|
||||||
|
IRC_CHANNEL = "#electrum"
|
||||||
|
RPC_PORT = 8332
|
||||||
|
|
||||||
|
|
||||||
class BitcoinTestnet(Coin):
|
class BitcoinTestnet(Bitcoin):
|
||||||
NAME = "Bitcoin"
|
|
||||||
SHORTNAME = "XTN"
|
SHORTNAME = "XTN"
|
||||||
REORG_LIMIT = 2000
|
|
||||||
NET = "testnet"
|
NET = "testnet"
|
||||||
XPUB_VERBYTES = bytes.fromhex("043587cf")
|
XPUB_VERBYTES = bytes.fromhex("043587cf")
|
||||||
XPRV_VERBYTES = bytes.fromhex("04358394")
|
XPRV_VERBYTES = bytes.fromhex("04358394")
|
||||||
P2PKH_VERBYTE = 0x6f
|
P2PKH_VERBYTE = 0x6f
|
||||||
P2SH_VERBYTE = 0xc4
|
P2SH_VERBYTE = 0xc4
|
||||||
WIF_BYTE = 0xef
|
WIF_BYTE = 0xef
|
||||||
|
REORG_LIMIT = 2000
|
||||||
|
|
||||||
|
|
||||||
# Source: pycoin and others
|
# Source: pycoin and others
|
||||||
@ -368,7 +366,7 @@ class Dash(Coin):
|
|||||||
TX_COUNT_HEIGHT = 569399
|
TX_COUNT_HEIGHT = 569399
|
||||||
TX_COUNT = 2157510
|
TX_COUNT = 2157510
|
||||||
TX_PER_BLOCK = 4
|
TX_PER_BLOCK = 4
|
||||||
DEFAULT_RPC_PORT = 9998
|
RPC_PORT = 9998
|
||||||
IRC_PREFIX = "D_"
|
IRC_PREFIX = "D_"
|
||||||
IRC_CHANNEL = "#electrum-dash"
|
IRC_CHANNEL = "#electrum-dash"
|
||||||
|
|
||||||
@ -379,7 +377,6 @@ class Dash(Coin):
|
|||||||
return x11_hash.getPoWHash(header)
|
return x11_hash.getPoWHash(header)
|
||||||
|
|
||||||
class DashTestnet(Dash):
|
class DashTestnet(Dash):
|
||||||
NAME = "Dash"
|
|
||||||
SHORTNAME = "tDASH"
|
SHORTNAME = "tDASH"
|
||||||
NET = "testnet"
|
NET = "testnet"
|
||||||
XPUB_VERBYTES = bytes.fromhex("3a805837")
|
XPUB_VERBYTES = bytes.fromhex("3a805837")
|
||||||
@ -392,5 +389,5 @@ class DashTestnet(Dash):
|
|||||||
TX_COUNT_HEIGHT = 101619
|
TX_COUNT_HEIGHT = 101619
|
||||||
TX_COUNT = 132681
|
TX_COUNT = 132681
|
||||||
TX_PER_BLOCK = 1
|
TX_PER_BLOCK = 1
|
||||||
DEFAULT_RPC_PORT = 19998
|
RPC_PORT = 19998
|
||||||
IRC_PREFIX = "d_"
|
IRC_PREFIX = "d_"
|
||||||
|
|||||||
@ -175,7 +175,8 @@ class DB(LoggedClass):
|
|||||||
headers = self.fs_read_headers(height, count)
|
headers = self.fs_read_headers(height, count)
|
||||||
# FIXME: move to coins.py
|
# FIXME: move to coins.py
|
||||||
hlen = self.coin.HEADER_LEN
|
hlen = self.coin.HEADER_LEN
|
||||||
return [self.coin.header_hash(header) for header in chunks(headers, hlen)]
|
return [self.coin.header_hash(header)
|
||||||
|
for header in chunks(headers, hlen)]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _resolve_limit(limit):
|
def _resolve_limit(limit):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user