New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated utils to handle regtest, simnet #153

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
3 participants
@tuxcanfly
Copy link
Contributor

tuxcanfly commented Jul 21, 2014

I found showblock useful but saw that it doesn't support simnet, so I've added support for regtest and simnet. Also updated other utils while I was at it.

@jrick

This comment has been minimized.

Copy link
Member

jrick commented Jul 21, 2014

These patches should also include a 'numNets' variable or similar so that multiple alternate networks specified either on the command line or in a config file can be caught. Take a look at how btcd implements this in config.go.

The network parameters also includes the network name, so showblock could get the name directly from there instead of hardcoding the directory name. The only gotcha here is that btcd saves testnet3 data into a "testnet" directory instead, so take a look at the netName function in btcd params.go for a sane way to get around this.

@tuxcanfly

This comment has been minimized.

Copy link
Contributor Author

tuxcanfly commented Jul 21, 2014

OK, updated to use netName and handle error case on passing multiple nets. Tested that the error cases shows the expected error message.


// Choose the active network params based on the selected network.
if cfg.TestNet3 {
activeNetParams = &btcnet.TestNet3Params

This comment has been minimized.

@davecgh

davecgh Jul 21, 2014

Member

Please just set these in the statements above. Only one will be set due to the if numNets > 1 check.

cfg.DataDir = filepath.Join(cfg.DataDir, testnet)
// Choose the active network params based on the selected network.
if cfg.TestNet3 {
activeNetParams = &btcnet.TestNet3Params

This comment has been minimized.

@davecgh

davecgh Jul 21, 2014

Member

Same as previous.


// Choose the active network params based on the selected network.
if cfg.TestNet3 {
activeNetParams = &btcnet.TestNet3Params

This comment has been minimized.

@davecgh

davecgh Jul 21, 2014

Member

Here too.

cfg.DataDir = filepath.Join(cfg.DataDir, testnet)
// Choose the active network params based on the selected network.
if cfg.TestNet3 {
activeNetParams = &btcnet.TestNet3Params

This comment has been minimized.

@davecgh

davecgh Jul 21, 2014

Member

Same.

@tuxcanfly

This comment has been minimized.

Copy link
Contributor Author

tuxcanfly commented Jul 21, 2014

Thanks @davecgh Updated to handle active network in the same if-else instead of another switch-case. Added comments explaining the change.

@davecgh

This comment has been minimized.

Copy link
Member

davecgh commented Jul 21, 2014

This looks good now. Thanks @tuxcanfly.

OK

@jrick

This comment has been minimized.

Copy link
Member

jrick commented Jul 21, 2014

OK

updated utils to handle regtest, simnet
handle active network assignment in the same if-else
instead of having another switch-case
@davecgh

This comment has been minimized.

Copy link
Member

davecgh commented Jul 22, 2014

This has been rebased and merged as commit 458a996.

@davecgh davecgh closed this Jul 22, 2014

@tuxcanfly tuxcanfly deleted the tuxcanfly:util-networks branch Jul 22, 2014

@tuxcanfly

This comment has been minimized.

Copy link
Contributor Author

tuxcanfly commented Jul 22, 2014

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment