parent
a019fde853
commit
1856cbe6c0
17
lib/coins.py
17
lib/coins.py
@ -43,6 +43,7 @@ class Coin(object):
|
|||||||
# Peer discovery
|
# Peer discovery
|
||||||
PEER_DEFAULT_PORTS = {'t': '50001', 's': '50002'}
|
PEER_DEFAULT_PORTS = {'t': '50001', 's': '50002'}
|
||||||
PEERS = []
|
PEERS = []
|
||||||
|
TX_COUNT_HEIGHT = 0
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def lookup_coin_class(cls, name, net):
|
def lookup_coin_class(cls, name, net):
|
||||||
@ -319,6 +320,7 @@ class BitcoinTestnet(Bitcoin):
|
|||||||
'testnet.not.fyi s t',
|
'testnet.not.fyi s t',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class BitcoinTestnetSegWit(BitcoinTestnet):
|
class BitcoinTestnetSegWit(BitcoinTestnet):
|
||||||
'''Bitcoin Testnet for Core bitcoind >= 0.13.1.
|
'''Bitcoin Testnet for Core bitcoind >= 0.13.1.
|
||||||
|
|
||||||
@ -361,7 +363,8 @@ class LitecoinTestnet(Litecoin):
|
|||||||
P2PKH_VERBYTE = 0x6f
|
P2PKH_VERBYTE = 0x6f
|
||||||
P2SH_VERBYTE = 0xc4
|
P2SH_VERBYTE = 0xc4
|
||||||
WIF_BYTE = 0xef
|
WIF_BYTE = 0xef
|
||||||
# Some details missing...
|
GENESIS_HASH = ('f5ae71e26c74beacc88382716aced69c'
|
||||||
|
'ddf3dffff24f384e1808905e0188f68f')
|
||||||
|
|
||||||
|
|
||||||
# Source: namecoin.org
|
# Source: namecoin.org
|
||||||
@ -374,9 +377,11 @@ class Namecoin(Coin):
|
|||||||
P2PKH_VERBYTE = 0x34
|
P2PKH_VERBYTE = 0x34
|
||||||
P2SH_VERBYTE = 0x0d
|
P2SH_VERBYTE = 0x0d
|
||||||
WIF_BYTE = 0xe4
|
WIF_BYTE = 0xe4
|
||||||
|
GENESIS_HASH = ('000000000062b72c5e2ceb45fbc8587e'
|
||||||
|
'807c155b0da735e6483dfba2f0a9c770')
|
||||||
|
|
||||||
|
|
||||||
class NamecoinTestnet(Coin):
|
class NamecoinTestnet(Namecoin):
|
||||||
NAME = "Namecoin"
|
NAME = "Namecoin"
|
||||||
SHORTNAME = "XNM"
|
SHORTNAME = "XNM"
|
||||||
NET = "testnet"
|
NET = "testnet"
|
||||||
@ -385,6 +390,7 @@ class NamecoinTestnet(Coin):
|
|||||||
P2PKH_VERBYTE = 0x6f
|
P2PKH_VERBYTE = 0x6f
|
||||||
P2SH_VERBYTE = 0xc4
|
P2SH_VERBYTE = 0xc4
|
||||||
WIF_BYTE = 0xef
|
WIF_BYTE = 0xef
|
||||||
|
# TODO add GENESIS_HASH
|
||||||
|
|
||||||
|
|
||||||
# For DOGE there is disagreement across sites like bip32.org and
|
# For DOGE there is disagreement across sites like bip32.org and
|
||||||
@ -398,9 +404,11 @@ class Dogecoin(Coin):
|
|||||||
P2PKH_VERBYTE = 0x1e
|
P2PKH_VERBYTE = 0x1e
|
||||||
P2SH_VERBYTE = 0x16
|
P2SH_VERBYTE = 0x16
|
||||||
WIF_BYTE = 0x9e
|
WIF_BYTE = 0x9e
|
||||||
|
GENESIS_HASH = ('1a91e3dace36e2be3bf030a65679fe82'
|
||||||
|
'1aa1d6ef92e7c9902eb318182c355691')
|
||||||
|
|
||||||
|
|
||||||
class DogecoinTestnet(Coin):
|
class DogecoinTestnet(Dogecoin):
|
||||||
NAME = "Dogecoin"
|
NAME = "Dogecoin"
|
||||||
SHORTNAME = "XDT"
|
SHORTNAME = "XDT"
|
||||||
NET = "testnet"
|
NET = "testnet"
|
||||||
@ -409,6 +417,8 @@ class DogecoinTestnet(Coin):
|
|||||||
P2PKH_VERBYTE = 0x71
|
P2PKH_VERBYTE = 0x71
|
||||||
P2SH_VERBYTE = 0xc4
|
P2SH_VERBYTE = 0xc4
|
||||||
WIF_BYTE = 0xf1
|
WIF_BYTE = 0xf1
|
||||||
|
GENESIS_HASH = ('bb0a78264637406b6360aad926284d54'
|
||||||
|
'4d7049f45189db5664f3c4d07350559e')
|
||||||
|
|
||||||
|
|
||||||
# Source: https://github.com/dashpay/dash
|
# Source: https://github.com/dashpay/dash
|
||||||
@ -436,6 +446,7 @@ class Dash(Coin):
|
|||||||
import x11_hash
|
import x11_hash
|
||||||
return x11_hash.getPoWHash(header)
|
return x11_hash.getPoWHash(header)
|
||||||
|
|
||||||
|
|
||||||
class DashTestnet(Dash):
|
class DashTestnet(Dash):
|
||||||
SHORTNAME = "tDASH"
|
SHORTNAME = "tDASH"
|
||||||
NET = "testnet"
|
NET = "testnet"
|
||||||
|
|||||||
@ -383,9 +383,13 @@ class BlockProcessor(server.db.DB):
|
|||||||
|
|
||||||
# Catch-up stats
|
# Catch-up stats
|
||||||
if self.utxo_db.for_sync:
|
if self.utxo_db.for_sync:
|
||||||
daemon_height = self.daemon.cached_height()
|
|
||||||
tx_per_sec = int(self.tx_count / self.wall_time)
|
tx_per_sec = int(self.tx_count / self.wall_time)
|
||||||
this_tx_per_sec = 1 + int(tx_diff / (self.last_flush - last_flush))
|
this_tx_per_sec = 1 + int(tx_diff / (self.last_flush - last_flush))
|
||||||
|
self.logger.info('tx/sec since genesis: {:,d}, '
|
||||||
|
'since last flush: {:,d}'
|
||||||
|
.format(tx_per_sec, this_tx_per_sec))
|
||||||
|
if self.coin.TX_COUNT_HEIGHT > 0:
|
||||||
|
daemon_height = self.daemon.cached_height()
|
||||||
if self.height > self.coin.TX_COUNT_HEIGHT:
|
if self.height > self.coin.TX_COUNT_HEIGHT:
|
||||||
tx_est = (daemon_height - self.height) * self.coin.TX_PER_BLOCK
|
tx_est = (daemon_height - self.height) * self.coin.TX_PER_BLOCK
|
||||||
else:
|
else:
|
||||||
@ -397,12 +401,14 @@ class BlockProcessor(server.db.DB):
|
|||||||
realism = 2.0 - 0.9 * self.height / self.coin.TX_COUNT_HEIGHT
|
realism = 2.0 - 0.9 * self.height / self.coin.TX_COUNT_HEIGHT
|
||||||
tx_est *= max(realism, 1.0)
|
tx_est *= max(realism, 1.0)
|
||||||
|
|
||||||
self.logger.info('tx/sec since genesis: {:,d}, '
|
|
||||||
'since last flush: {:,d}'
|
|
||||||
.format(tx_per_sec, this_tx_per_sec))
|
|
||||||
self.logger.info('sync time: {} ETA: {}'
|
self.logger.info('sync time: {} ETA: {}'
|
||||||
.format(formatted_time(self.wall_time),
|
.format(formatted_time(self.wall_time),
|
||||||
formatted_time(tx_est / this_tx_per_sec)))
|
formatted_time(tx_est / this_tx_per_sec)))
|
||||||
|
else:
|
||||||
|
self.logger.info('sync time: {}'
|
||||||
|
.format(formatted_time(self.wall_time)))
|
||||||
|
|
||||||
|
|
||||||
def fs_flush(self):
|
def fs_flush(self):
|
||||||
'''Flush the things stored on the filesystem.'''
|
'''Flush the things stored on the filesystem.'''
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user