Skip to content

Commit

Permalink
Prevent startup on net 'bitcoin' with Bitcoin Cash or Bitcoin Gold cl…
Browse files Browse the repository at this point in the history
…ients
  • Loading branch information
jtoomim committed Dec 10, 2017
1 parent d8de77e commit ee0d7ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions p2pool/bitcoin/helper.py
Expand Up @@ -129,9 +129,9 @@ def submit_block(block, ignore_failure, factory, bitcoind, bitcoind_work, net):
submit_block_rpc(block, ignore_failure, bitcoind, bitcoind_work, net)

@defer.inlineCallbacks
def check_genesis_block(bitcoind, genesis_block_hash):
def check_block_header(bitcoind, block_hash):
try:
yield bitcoind.rpc_getblockheader(genesis_block_hash)
yield bitcoind.rpc_getblockheader(block_hash)
except jsonrpc.Error_for_code(-5):
defer.returnValue(False)
else:
Expand Down
4 changes: 3 additions & 1 deletion p2pool/bitcoin/networks/bitcoin.py
Expand Up @@ -12,7 +12,9 @@
ADDRESS_VERSION = 0
RPC_PORT = 8332
RPC_CHECK = defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
(yield helper.check_genesis_block(bitcoind, '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f')) and
(yield helper.check_block_header(bitcoind, '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f')) and # genesis block
(yield helper.check_block_header(bitcoind, '00000000000000000019f112ec0a9982926f1258cdcc558dd7c3b7e5dc7fa148')) and # 478559 -- Bitcoin Cash fork
(yield helper.check_block_header(bitcoind, '0000000000000000002ac644c9ba8ac3be966276fb7fc8f3baa1a3b9bdc615f1')) and # 491408 -- Bitcoin Gold fork
not (yield bitcoind.rpc_getinfo())['testnet']
))
SUBSIDY_FUNC = lambda height: 50*100000000 >> (height + 1)//210000
Expand Down

0 comments on commit ee0d7ca

Please sign in to comment.