Skip to content

Commit

Permalink
Disable the checkpoint for regtest for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
rt121212121 committed Aug 17, 2020
1 parent 4efd135 commit b61bd09
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 6 additions & 8 deletions electrumsv/networks.py
Expand Up @@ -259,7 +259,7 @@ class SVRegTestnet(object):
REGTEST_DEFAULT_ACCOUNT_SEED = 'tprv8ZgxMBicQKsPd4wsdaJ11eH84eq4hHLX1K6Mx8EQQhJzq8jr25WH1m8hg' \
'GkCqnksJDCZPZbDoMbQ6QtroyCyn5ZckCmsLeiHDb1MAxhNUHN'

MIN_CHECKPOINT_HEIGHT = 200
MIN_CHECKPOINT_HEIGHT = 0
ADDRTYPE_P2PKH = 111
ADDRTYPE_P2SH = 196
CASHADDR_PREFIX = "bchtest"
Expand All @@ -272,14 +272,12 @@ class SVRegTestnet(object):
BIP276_VERSION = 2
COIN = BitcoinRegtest

# Use the following for a chain reset.
CHECKPOINT = CheckPoint(bytes.fromhex(
'0000002029f1e3df7fda466242b9b56076792ffdb9e5d7ea51610307bc010000000000007ac1fa84'
'ef5f0998232fb01cd6fea2c0199e34218df2fb33e4e80e79d22b6a746994435d41c4021a208bae0a'
), height=123, prev_work=123)

VERIFICATION_BLOCK_MERKLE_ROOT = (
'93414acafdef2dad790c456a424a6a261b66771a3426117125d8c13a1c93f10e'
)
'0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd'
'7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4adae5494dffff001d1aa4ae18'
), height=0, prev_work=0)
VERIFICATION_BLOCK_MERKLE_ROOT = None

BIP44_COIN_TYPE = 1

Expand Down
6 changes: 4 additions & 2 deletions electrumsv/regtest_support.py
Expand Up @@ -4,7 +4,8 @@
from typing import List

import requests
from bitcoinx import Headers, MissingHeader, CheckPoint, bits_to_work, P2PKH_Address
from bitcoinx import Headers, MissingHeader, CheckPoint, bits_to_work, P2PKH_Address, \
hash_to_hex_str
from electrumsv.bitcoin import COINBASE_MATURITY

from electrumsv.networks import Net, BLOCK_HEIGHT_OUT_OF_RANGE_ERROR
Expand Down Expand Up @@ -135,7 +136,8 @@ def calculate_regtest_checkpoint(height):

checkpoint = CheckPoint(raw_header=checkpoint_raw_header,
height=Net.MIN_CHECKPOINT_HEIGHT, prev_work=prev_work)
verification_block_merkle_root = checkpoint_raw_header[36:68]
verification_block_merkle_root = None if Net.MIN_CHECKPOINT_HEIGHT < 150 \
else hash_to_hex_str(checkpoint_raw_header[36:68])
return checkpoint, verification_block_merkle_root

except requests.HTTPError as e:
Expand Down

0 comments on commit b61bd09

Please sign in to comment.