8000 Added regtest network by popzxc · Pull Request #84 · rust-bitcoin/rust-bitcoin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Added regtest network #84

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

Merged
merged 2 commits into from
Jun 4, 2018
Merged

Added regtest network #84

merged 2 commits into from
Jun 4, 2018

Conversation

popzxc
Copy link
Contributor
@popzxc popzxc commented May 17, 2018

No description provided.

@tamasblummer tamasblummer self-requested a review May 20, 2018 09:29
@popzxc
Copy link
Contributor Author
popzxc commented May 24, 2018

Hello guys.
I'm currently working on a few more pull-requests, which are adding consensus parameters for different chains and block header verification and acceptance.

Unfortunately, I can't create them until this regtest PR is merged.

Could you please give me some feedback, if there is something wrong with this PR?

@tamasblummer
Copy link
Contributor
tamasblummer commented May 24, 2018

As I wrote before: I do not support panic! in this library. It is fine to fail an application in an unrecoverable state, but a library should rather propagate errors via Result<>

Copy link
Contributor
@tamasblummer tamasblummer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove panic. propagate errors if needed.

8000
@@ -162,7 +162,8 @@ impl Address {
fn bech_network (network: Network) -> bitcoin_bech32::constants::Network {
match network {
Network::Bitcoin => bitcoin_bech32::constants::Network::Bitcoin,
Network::Testnet => bitcoin_bech32::constants::Network::Testnet
Network::Testnet => bitcoin_bech32::constants::Network::Testnet,
_ => panic!("Invalid network to be converted"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not panic, here. Better cover all cases or propagate error. This is a library not an application that might chose to fail early.

@tamasblummer
Copy link
Contributor

@popzxc I am sorry, I just recognized that github does not show my feedback in a review until the review is marked finished. Therefore you did not see my feedback I provided a few days ago until now.

@popzxc
Copy link
Contributor Author
popzxc commented May 24, 2018

That's ok. I'll fix that in a few days :)

@popzxc
Copy link
Contributor Author
popzxc commented May 27, 2018

Well, generally regtest behaves on the same rules as testnet, so I decided to not complicate things and replaced panics such way that regtest mimics testnet.
On the one hand, it won't bring any erroneous behavior, and even more: developers will be able to test some features without testnet.
On the other one, logic is now kind of asymmetric, e.g. bip32-encoded regtest private key will be decoded as the testnet one. But expecting another behavior will mean a logical error in the client-side code, so I think that it's not a big deal.

Another solution will cause more changes: e.g. method to_string in bip32 should return String, not a Result, so we'll have to get rid off of the ToString trait for ExtendedPrivKey. It may broke some client-side code, and I believe that's not what we want.

@apoelstra
Copy link
Member

Please clean up the history.

popzxc added 2 commits May 29, 2018 12:21
Completed regtest integration to the code

Added tests for regtest

Get rid of panics
@popz
8000
xc
Copy link
Contributor Author
popzxc commented May 29, 2018

Done.

@apoelstra
Copy link
Member

ACK

@apoelstra apoelstra merged commit dd176b4 into rust-bitcoin:master Jun 4, 2018
@popzxc popzxc deleted the add-regtest branch June 5, 2018 07:55
@apoelstra
Copy link
Member

See #94 -- this will need to be reverted and moved to 0.14. Sorry about that.

@popzxc
Copy link
Contributor Author
popzxc commented Jun 16, 2018

Maybe then just reorder commits in such way that this feature will be after the commit that'll be marked as 0.13.2? Just for those people who possibly already use this feature.

@apoelstra
Copy link
Member

We can't reorder commits in master.

@popzxc
Copy link
Contributor Author
popzxc commented Jun 16, 2018

Ok then.

apoelstra added a commit that referenced this pull request Jun 22, 2018
Reverts #84, bumps Cargo minor version number, and re-adds #84
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0