vbuterin / pybitcointools

SImple, common-sense Bitcoin-themed Python ECC library
1.28k stars 857 forks source link

Does function decode_privkey in main.py need a special case for wif format? #24

Closed eleutheros closed 9 years ago

eleutheros commented 10 years ago

Specifically, I made these changes:

    #else:
    # bin_p = b58check_to_bin(priv)
    # if len(bin_p) == 32: return decode(bin_p,256)
    # elif len(bin_p) == 33: return decode(bin_p[:32],256)
    # else: raise Exception("WIF does not represent privkey")
    elif formt == 'wif': return decode(b58check_to_bin(priv),256)
    elif formt == 'wif_compressed': return decode(b58check_to_bin(priv)[:32],256)
    else: raise Exception("Invalid privkey format!")

Is there any reason why there is special handling of 'wif' stuff here? It is identical to stuff in the function get_privkey_format . I would make a normal pull request, but my fork is a translation to Racket Scheme, and I don't want to figure out handling multiple branches and whatnot.

vbuterin commented 9 years ago

Good point! Adding now