helper_bitcoin pylint fixes
This commit is contained in:
parent
31e3d60fb0
commit
27c58b05f3
|
@ -1,11 +1,19 @@
|
||||||
|
"""
|
||||||
|
Calculates bitcoin and testnet address from pubkey
|
||||||
|
"""
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
|
from debug import logger
|
||||||
from pyelliptic import arithmetic
|
from pyelliptic import arithmetic
|
||||||
|
|
||||||
# This function expects that pubkey begin with \x04
|
|
||||||
def calculateBitcoinAddressFromPubkey(pubkey):
|
def calculateBitcoinAddressFromPubkey(pubkey):
|
||||||
"""This function expects that pubkey begin's with the bitcoin prefix"""
|
"""Calculate bitcoin address from given pubkey (65 bytes long hex string)"""
|
||||||
if len(pubkey) != 65:
|
if len(pubkey) != 65:
|
||||||
print 'Could not calculate Bitcoin address from pubkey because function was passed a pubkey that was', len(pubkey), 'bytes long rather than 65.'
|
logger.error('Could not calculate Bitcoin address from pubkey because'
|
||||||
|
' function was passed a pubkey that was'
|
||||||
|
' %i bytes long rather than 65.', len(pubkey))
|
||||||
return "error"
|
return "error"
|
||||||
ripe = hashlib.new('ripemd160')
|
ripe = hashlib.new('ripemd160')
|
||||||
sha = hashlib.new('sha256')
|
sha = hashlib.new('sha256')
|
||||||
|
@ -25,8 +33,11 @@ def calculateBitcoinAddressFromPubkey(pubkey):
|
||||||
|
|
||||||
|
|
||||||
def calculateTestnetAddressFromPubkey(pubkey):
|
def calculateTestnetAddressFromPubkey(pubkey):
|
||||||
|
"""This function expects that pubkey begin with the testnet prefix"""
|
||||||
if len(pubkey) != 65:
|
if len(pubkey) != 65:
|
||||||
print 'Could not calculate Bitcoin address from pubkey because function was passed a pubkey that was', len(pubkey), 'bytes long rather than 65.'
|
logger.error('Could not calculate Bitcoin address from pubkey because'
|
||||||
|
' function was passed a pubkey that was'
|
||||||
|
' %i bytes long rather than 65.', len(pubkey))
|
||||||
return "error"
|
return "error"
|
||||||
ripe = hashlib.new('ripemd160')
|
ripe = hashlib.new('ripemd160')
|
||||||
sha = hashlib.new('sha256')
|
sha = hashlib.new('sha256')
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
"""
|
||||||
|
Insert operation into sent table
|
||||||
|
"""
|
||||||
|
|
||||||
from helper_sql import *
|
from helper_sql import *
|
||||||
|
|
||||||
def insert(t):
|
def insert(t):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user