Skip to content

Commit

Permalink
Add Caishen support
Browse files Browse the repository at this point in the history
  • Loading branch information
Lovok committed Apr 24, 2014
1 parent 009e21a commit 6a0686e
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions p2pool/bitcoin/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,24 @@ def spa_sub(n):

return 101-i

def get_caishensubsidy(bnHeight):
nSubsidy = 28

if bnHeight == 0:
nSubsidy = 1
elif bnHeight < 2:
nSubsidy = 560000
elif bnHeight > 3583630:
nSubsidy = 1
elif bnHeight > 2150178:
nSubsidy = 3
elif bnHeight > 1075089:
nSubsidy = 5
elif bnHeight > 358363:
nSubsidy = 10

return int(nSubsidy * 1000000)

def get_subsidy(nCap, nMaxSubsidy, bnTarget):
bnLowerBound = 0.01
bnUpperBound = bnSubsidyLimit = nMaxSubsidy
Expand Down Expand Up @@ -246,6 +264,28 @@ def check_genesis_block(bitcoind, genesis_block_hash):
DUST_THRESHOLD=0.03e8,
),

caishen=math.Object(
P2P_PREFIX='fabfb5da'.decode('hex'),
P2P_PORT=14260,
ADDRESS_VERSION=28,
RPC_PORT=14261,
RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
'caishenaddress' in (yield bitcoind.rpc_help()) and
not (yield bitcoind.rpc_getinfo())['testnet']
)),
SUBSIDY_FUNC=lambda height: get_caishensubsidy(height),
POW_FUNC=lambda data: pack.IntType(256).unpack(__import__('vtc_scrypt').getPoWHash(data)),
BLOCK_PERIOD=88, # s
SYMBOL='CAI',
CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'Caishen') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/Caishen/') if platform.system() == 'Darwin' else os.path.expanduser('~/.caishen'), 'caishen.conf'),
BLOCK_EXPLORER_URL_PREFIX='http://greekpool.eu:29000/block/',
ADDRESS_EXPLORER_URL_PREFIX='http://greekpool.eu:29000/address/',
TX_EXPLORER_URL_PREFIX='http://greekpool.eu:29000/tx/',
SANE_TARGET_RANGE=(2**256//1000000000 - 1, 2**256//1000 - 1),
DUMB_SCRYPT_DIFF=2**16,
DUST_THRESHOLD=0.03e8,
),

)
for net_name, net in nets.iteritems():
net.NAME = net_name

0 comments on commit 6a0686e

Please sign in to comment.