Skip to content

Commit

Permalink
Update the chainparams update scripts to NOT touch scalenet chainwork
Browse files Browse the repository at this point in the history
Summary
---

In recent work in MR !1173, we accidentally almost updated the scalenet
chain params.  Since scalenet is intended to reorg back to block 10,000
in the future, it is not a good idea to update the chain params for this
network since it would make reorging problematic.

This MR adds a sys.exit() call to the `make_chainparams.py` script if it
encounters scalenet.  A dev will need to manually edit that script if
they wish to actually update scalenet.

This extra safety feature avoids the situation where someone may
inadvertently update scalenet's chain params, commit the change to
master, then publish a release with the updated chain params, making
reorgs of scalenet troublesome.

This MR closes issue Bitcoin-ABC#293

Test Plan
---

1. Review
2. Try it out:

- `cd devtools/chainparams`

- Run `bitcoind` on any network **OTHER** than scalenet.
- `./make_chainparams.py -a host:port -c /path/to/notscalenet.conf` <--
  this should output some chain params (2 lines of hex)

- Run `bitcoind` **OON** scalenet.
- `./make_chainparams.py -a host:port -c /path/to/scalenet.conf` <--
  this should output an error message
  • Loading branch information
cculianu committed Apr 15, 2021
1 parent 0487206 commit 67cb583
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions contrib/devtools/chainparams/README.md
Expand Up @@ -32,6 +32,12 @@ bitcoind --scalenet
python3 make_chainparams.py -a 127.0.0.1:38332 > chainparams_scalenet.txt
```

**Note**: Scalenet should not be updated since it already has the chainparams it
needs to be reorged back to height 10,000. Without manually editing to comment-out
the sys.exit call, the above script will exit with an error message if executed
against a `bitcoind` that is on scalenet.


## Build C++ Header File
```
python3 generate_chainparams_constants.py . > ../../../src/chainparamsconstants.h
Expand Down
4 changes: 4 additions & 0 deletions contrib/devtools/chainparams/make_chainparams.py
Expand Up @@ -31,6 +31,10 @@ def get_chainparams(rpc_caller, block):
chain = Chain.TestNet4
elif chaininfo['chain'] == 'scale':
chain = Chain.ScaleNet
# Comment-out the below to actually update chain params for scalenet
sys.exit("ScaleNet chainparams should not be updated. See BCHN issue "
"#293. If you really wish to proceed anyway, then please "
"edit this script to comment-out this line of code.")
else:
raise NotImplementedError

Expand Down

0 comments on commit 67cb583

Please sign in to comment.