Closed oskyk closed 6 years ago
Great job! I will take some time to thoroughly review it and run the appropriate tests.
I did a first review of the code, summarised in the comments above. Please double-check with unit tests. In the meantime, new commits created a merge conflict but I think the only problem is in crypto.py
, a typo fix on line 49, so it should be easy to adapt.
Confilict is fixed, integration test is passing, unittest results are same as on master
My tests are failing because of circular imports, are you sure your tests are running the updated version of btcpy
and not an old version installed at system level? I added a note here on how to make sure one is running the version currently in the repo during testing. Please note that to make that work you should update your local PR branch to the last commit of the master branch which adds __init__.py
to the tests
folder and other minor fixes.
Sorry about that. It's fixed now
Sorry for the very late feedback, very busy period. Actually, to fix the circular import problem it would have been enough to move the import statements inside the init_constants
method. I think that solution would be better instead of having every module directly access the global dictionary.
I tried it and it at first and was not working properly and every module has to access global directory because of net_name() and is_mainnet() functions.
Preferably the lib should take argument in form of NamedTuple, or inherit a class carrying custom parameters for *coin. In this way upstream won't carry the settings in it's repo (except for Bitcoin) but each individual application will provide custom parameters upon initialization.
@peerchemist seems like a good idea, do you think you can do a PR (or modify this one) with the change you have in mind?
I can try, I can't promise on the time-frame though as I am horribly busy lately.
I've submitted my take on this problem here: https://github.com/chainside/btcpy/pull/25
As you can now custom (application defined) Constants class can be passed to library upon setup. Also, now setup.py defines the network parameters for the library which makes more sense than it made before.
With this PR it would be much easier to add another bitcoin clone into btcpy but, but existing functionality is unchanged and no new coins were added.