From db08dfa5553d6517815d3e1aeffebff5cebe8261 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Sun, 30 Jul 2017 21:57:18 +0300 Subject: [PATCH] reassing DEBUG, INFO etc. log messages --- jmclient/jmclient/maker.py | 4 ++-- jmclient/jmclient/taker.py | 28 +++++++++++++++------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/jmclient/jmclient/maker.py b/jmclient/jmclient/maker.py index 0800d2c..e7ff769 100644 --- a/jmclient/jmclient/maker.py +++ b/jmclient/jmclient/maker.py @@ -132,7 +132,7 @@ class Maker(object): real_cjfee = calc_cj_fee(ordertype, cjfee, amount) expected_change_value = (my_total_in - amount - txfee + real_cjfee) jlog.info('potentially earned = {}'.format(real_cjfee - txfee)) - jlog.debug('mycjaddr, mychange = {}, {}'.format(cjaddr, changeaddr)) + jlog.info('mycjaddr, mychange = {}, {}'.format(cjaddr, changeaddr)) times_seen_cj_addr = 0 times_seen_change_addr = 0 @@ -160,7 +160,7 @@ class Maker(object): order = [o for o in self.offerlist if o['oid'] == oid] if len(order) == 0: fmt = 'didnt cancel order which doesnt exist, oid={}'.format - jlog.debug(fmt(oid)) + jlog.info(fmt(oid)) self.offerlist.remove(order[0]) if len(to_announce) > 0: for ann in to_announce: diff --git a/jmclient/jmclient/taker.py b/jmclient/jmclient/taker.py index a5a223c..f46474e 100644 --- a/jmclient/jmclient/taker.py +++ b/jmclient/jmclient/taker.py @@ -128,7 +128,8 @@ class Taker(object): #reset to satoshis self.cjamount = int(self.cjamount * self.mixdepthbal) if self.cjamount < jm_single().mincjamount: - jlog.debug("Coinjoin amount too low, bringing up.") + jlog.info("Coinjoin amount too low, bringing up to: " + str( + jm_single().mincjamount)) self.cjamount = jm_single().mincjamount self.n_counterparties = si[2] self.my_cj_addr = si[3] @@ -217,7 +218,7 @@ class Taker(object): #txfee indicates undesirable behaviour on maker side anyway. self.total_txfee = 2 * self.txfee_default * self.n_counterparties total_amount = self.cjamount + self.total_cj_fee + self.total_txfee - jlog.debug('total estimated amount spent = ' + str(total_amount)) + jlog.info('total estimated amount spent = ' + str(total_amount)) try: self.input_utxos = self.wallet.select_utxos(self.mixdepth, total_amount) @@ -239,8 +240,8 @@ class Taker(object): jlog.debug("Estimated outs: "+str(est_outs)) estimated_fee = estimate_tx_fee(est_ins, est_outs, txtype=self.wallet.get_txtype()) - jlog.info("We have a fee estimate: "+str(estimated_fee)) - jlog.info("And a requested fee of: "+str( + jlog.debug("We have a fee estimate: "+str(estimated_fee)) + jlog.debug("And a requested fee of: "+str( self.txfee_default * self.n_counterparties)) self.total_txfee = max([estimated_fee, self.n_counterparties * self.txfee_default]) @@ -275,7 +276,8 @@ class Taker(object): for nick, nickdata in ioauth_data.iteritems(): utxo_list, auth_pub, cj_addr, change_addr, btc_sig, maker_pk = nickdata if not self.auth_counterparty(btc_sig, auth_pub, maker_pk): - jlog.debug("Counterparty encryption verification failed, aborting") + jlog.debug( + "Counterparty encryption verification failed, aborting: " + nick) #This counterparty must be rejected rejected_counterparties.append(nick) @@ -290,7 +292,7 @@ class Taker(object): utxo_data = jm_single().bc_interface.query_utxo_set(self.utxos[ nick]) if None in utxo_data: - jlog.debug(('ERROR outputs unconfirmed or already spent. ' + jlog.warn(('ERROR outputs unconfirmed or already spent. ' 'utxo_data={}').format(pprint.pformat(utxo_data))) # when internal reviewing of makers is created, add it here to # immediately quit; currently, the timeout thread suffices. @@ -323,7 +325,7 @@ class Taker(object): if change_amount < jm_single().DUST_THRESHOLD: fmt = ('ERROR counterparty requires sub-dust change. nick={}' 'totalin={:d} cjamount={:d} change={:d}').format - jlog.debug(fmt(nick, total_input, self.cjamount, change_amount)) + jlog.warn(fmt(nick, total_input, self.cjamount, change_amount)) jlog.warn("Invalid change, too small, nick= " + nick) continue @@ -331,7 +333,7 @@ class Taker(object): 'value': change_amount}) fmt = ('fee breakdown for {} totalin={:d} ' 'cjamount={:d} txfee={:d} realcjfee={:d}').format - jlog.debug(fmt(nick, total_input, self.cjamount, self.orderbook[ + jlog.info(fmt(nick, total_input, self.cjamount, self.orderbook[ nick]['txfee'], real_cjfee)) self.outputs.append({'address': cj_addr, 'value': self.cjamount}) self.cjfee_total += real_cjfee @@ -385,7 +387,7 @@ class Taker(object): # seems you wont always get exactly zero because of integer # rounding so 1 satoshi extra or fewer being spent as miner # fees is acceptable - jlog.debug(('WARNING CHANGE NOT BEING ' + jlog.info(('WARNING CHANGE NOT BEING ' 'USED\nCHANGEVALUE = {}').format(my_change_value)) else: self.outputs.append({'address': self.my_change_addr, @@ -397,7 +399,7 @@ class Taker(object): random.shuffle(self.utxo_tx) random.shuffle(self.outputs) tx = btc.mktx(self.utxo_tx, self.outputs) - jlog.debug('obtained tx\n' + pprint.pformat(btc.deserialize(tx))) + jlog.info('obtained tx\n' + pprint.pformat(btc.deserialize(tx))) self.latest_tx = btc.deserialize(tx) for index, ins in enumerate(self.latest_tx['ins']): @@ -499,7 +501,7 @@ class Taker(object): if not tx_signed: return False assert not len(self.nonrespondants) - jlog.debug('all makers have sent their signatures') + jlog.info('all makers have sent their signatures') self.taker_info_callback("INFO", "Transaction is valid, signing..") jlog.debug("schedule item was: " + str(self.schedule[self.schedule_index])) return self.self_sign_and_push() @@ -651,7 +653,7 @@ class Taker(object): tx = btc.serialize(self.latest_tx) jlog.debug('\n' + tx) self.txid = btc.txhash(tx) - jlog.debug('txid = ' + self.txid) + jlog.info('txid = ' + self.txid) tx_broadcast = jm_single().config.get('POLICY', 'tx_broadcast') nick_to_use = None if tx_broadcast == 'self': @@ -686,7 +688,7 @@ class Taker(object): return self.push() def unconfirm_callback(self, txd, txid): - jlog.debug("Transaction seen on network, waiting for confirmation") + jlog.info("Transaction seen on network, waiting for confirmation") #To allow client to mark transaction as "done" (e.g. by persisting state) self.on_finished_callback(True, fromtx="unconfirmed") self.waiting_for_conf = True