ymgve / bitcoin_fork_claimer

Script for transferring/claiming your coins on various Bitcoin forks
204 stars 86 forks source link

Remove unsafe 'assert' and replace it with a proper exception #58

Open Steve132 opened 6 years ago

Steve132 commented 6 years ago

I'm working on some improvements to your script with an eye to integrating it with my open source wallet in the future.

One thing I noticed is that on my build environment "assert" is disabled, which leads to bugs because "assert" is not supposed to be used for runtime error checking, only for debug environments.

Assertions should not be used to test for failure cases that can occur because of bad user input or operating system/environment failures, such as a file not being found. Instead, you should raise an exception, or print an error message, or whatever is appropriate. One important reason why assertions should only be used for self-tests of the program is that assertions can be disabled at compile time.

https://wiki.python.org/moin/UsingAssertionsEffectively

So I replaced the assertions with a quick wrapper that works around that bug.