From 27c58b05f3caa549da8b25b94e35787eb0e4222f Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Mon, 7 Oct 2019 19:28:12 +0530 Subject: [PATCH] helper_bitcoin pylint fixes --- src/helper_bitcoin.py | 19 +++++++++++++++---- src/helper_sent.py | 4 ++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/helper_bitcoin.py b/src/helper_bitcoin.py index f8146285..d4f1d105 100644 --- a/src/helper_bitcoin.py +++ b/src/helper_bitcoin.py @@ -1,11 +1,19 @@ +""" +Calculates bitcoin and testnet address from pubkey +""" + import hashlib + +from debug import logger from pyelliptic import arithmetic -# This function expects that pubkey begin with \x04 + 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: - 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" ripe = hashlib.new('ripemd160') sha = hashlib.new('sha256') @@ -25,8 +33,11 @@ def calculateBitcoinAddressFromPubkey(pubkey): def calculateTestnetAddressFromPubkey(pubkey): + """This function expects that pubkey begin with the testnet prefix""" 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" ripe = hashlib.new('ripemd160') sha = hashlib.new('sha256') diff --git a/src/helper_sent.py b/src/helper_sent.py index 8dde7215..6b73c8c5 100644 --- a/src/helper_sent.py +++ b/src/helper_sent.py @@ -1,3 +1,7 @@ +""" +Insert operation into sent table +""" + from helper_sql import * def insert(t):