4 from twisted.internet import defer
7 from p2pool.util import math, pack
10 def get_subsidy(nCap, nMaxSubsidy, bnTarget):
12 bnUpperBound = bnSubsidyLimit = nMaxSubsidy
13 bnTargetLimit = 0x00000fffff000000000000000000000000000000000000000000000000000000
15 while bnLowerBound + 0.01 <= bnUpperBound:
16 bnMidValue = (bnLowerBound + bnUpperBound) / 2
17 if pow(bnMidValue, nCap) * bnTargetLimit > pow(bnSubsidyLimit, nCap) * bnTarget:
18 bnUpperBound = bnMidValue
20 bnLowerBound = bnMidValue
22 nSubsidy = round(bnMidValue, 2)
24 if nSubsidy > bnMidValue:
25 nSubsidy = nSubsidy - 0.01
27 return int(nSubsidy * 1000000)
31 P2P_PREFIX='e4e8e9e5'.decode('hex'),
35 RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
36 'novacoinaddress' in (yield bitcoind.rpc_help()) and
37 not (yield bitcoind.rpc_getinfo())['testnet']
39 SUBSIDY_FUNC=lambda target: get_subsidy(6, 100, target),
40 BLOCKHASH_FUNC=lambda data: pack.IntType(256).unpack(__import__('ltc_scrypt').getPoWHash(data)),
41 POW_FUNC=lambda data: pack.IntType(256).unpack(__import__('ltc_scrypt').getPoWHash(data)),
44 CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'NovaCoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/NovaCoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.novacoin'), 'novacoin.conf'),
45 BLOCK_EXPLORER_URL_PREFIX='http://novacoin.ru/block/',
46 ADDRESS_EXPLORER_URL_PREFIX='http://novacoin.ru/address/',
47 SANE_TARGET_RANGE=(2**256//1000000000 - 1, 2**256//1000 - 1),
49 novacoin_testnet=math.Object(
50 P2P_PREFIX='cdf2c0ef'.decode('hex'),
54 RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
55 'novacoinaddress' in (yield bitcoind.rpc_help()) and
56 (yield bitcoind.rpc_getinfo())['testnet']
58 SUBSIDY_FUNC=lambda target: get_subsidy(6, 100, target),
59 BLOCKHASH_FUNC=lambda data: pack.IntType(256).unpack(__import__('ltc_scrypt').getPoWHash(data)),
60 POW_FUNC=lambda data: pack.IntType(256).unpack(__import__('ltc_scrypt').getPoWHash(data)),
63 CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'NovaCoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/NovaCoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.novacoin'), 'novacoin.conf'),
64 BLOCK_EXPLORER_URL_PREFIX='http://nonexistent-novacoin-testnet-explorer/block/',
65 ADDRESS_EXPLORER_URL_PREFIX='http://nonexistent-novacoin-testnet-explorer/address/',
66 SANE_TARGET_RANGE=(2**256//1000000000 - 1, 2**256//1000 - 1),
69 for net_name, net in nets.iteritems():