chainside / btcpy

A Python3 SegWit-compliant library which provides tools to handle Bitcoin data structures in a simple fashion.
https://www.chainside.net
GNU Lesser General Public License v3.0
270 stars 73 forks source link

Network namedtuple constants #43

Closed peerchemist closed 5 years ago

peerchemist commented 6 years ago

Port of https://github.com/PeerAssets/btcpy/pull/7/commits/ff51e4d58766f9cd9445141f55c9b6626f34d608 from PeerAssets fork.

It greatly simplifies internal state, dropping all mainnet=None arguments of various methods through the codebase.

peerchemist commented 6 years ago

Hi, do you plan to merge this? I guess it needs an update now to reflect the recent changes.

SimoneBronzini commented 6 years ago

There are a couple of parts I need to review thoroughly, as soon as I find the time to do that I'll leave you some feedback

SimoneBronzini commented 6 years ago

All right, I did a quick review of the code, I think it has the following problems:

This PR would, of course, simplify the code but it would remove a layer of safety that I don't think is a good idea to remove.

On an unrelated note, I noticed you also replaced all relative imports with absolute imports. I am not sure what is the reason behind this.