Open Saturnix opened 8 years ago
Thanks @Saturnix - would you like to submit a pull request?
Hello @shea256, thanks for your interest and wonderful work.
Do you agree that get_unspents should return empty list in this case? Please consider the impact this might have and possible regressions: I have not done so. A "find usages" of get_unspents finds no other place where this is used, so we should be fine.
Yes: I'd like to do a pull request now, though I'm completely new to Git. Sorry in advance should I fail to do so adequately.
Yes, I agree that this should be an empty list.
Separate issue, but I'd point out that your bitcoin address isn't valid.
And no worries - I'd try looking into how to do a pull request and if you can't figure it out, I can always make the change. But I find it's best if contributors make the changes themselves, for the community at least.
What you should do:
Done. I hope I did everything ok.
Separate issue, but I'd point out that your bitcoin address isn't valid.
You're right: thanks for pointing out. I generated that address with your class BitcoinPrivateKey. I'll figure out if I've done something wrong with it or if there is a bug in pybitcoin. I suspect the first case: I'll report back.
My error. To do some tests I've added "asdasd" inside of the address to check how the library handles invalid addresses. So I've copied the call to get_unspents with the invalid address, instead of the correct one (which is "get_unspents("19SbDNEkwRqnBAv7Ewumy7XcCau9Wp4BH9")).
1AM in the morning, I need to get some sleep...
get_unspents("19SbDasdasdNEkwRqnBAv7Ewumy7XcCau9Wp4BH9")
Expected behavior: result: [ ]
Actual behavior: result: Exception('Invalid response from blockchain.info.')
Reson: blockchain.info returns non-JSON response "No free outputs to spend" if the address is valid but with no unspents. The file "blockchain_info.py" (at lines 49 to 53) doesn't check for non-JSON responses but blatantly returns error if it cannot parse JSON content.
Proposed fix: at line 50: if r.content == "No free outputs to spend": return [ ]