helper_bitcoin pylint fixes

This commit is contained in:
lakshyacis 2019-10-07 19:28:12 +05:30
parent 31e3d60fb0
commit 27c58b05f3
No known key found for this signature in database
GPG Key ID: D2C539C8EC63E9EB
2 changed files with 19 additions and 4 deletions

View File

@ -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')

View File

@ -1,3 +1,7 @@
"""
Insert operation into sent table
"""
from helper_sql import * from helper_sql import *
def insert(t): def insert(t):