Browse Source

reassing DEBUG, INFO etc. log messages

master
Adam Gibson 8 years ago
parent
commit
db08dfa555
No known key found for this signature in database
GPG Key ID: B3AE09F1E9A3197A
  1. 4
      jmclient/jmclient/maker.py
  2. 28
      jmclient/jmclient/taker.py

4
jmclient/jmclient/maker.py

@ -132,7 +132,7 @@ class Maker(object):
real_cjfee = calc_cj_fee(ordertype, cjfee, amount) real_cjfee = calc_cj_fee(ordertype, cjfee, amount)
expected_change_value = (my_total_in - amount - txfee + real_cjfee) expected_change_value = (my_total_in - amount - txfee + real_cjfee)
jlog.info('potentially earned = {}'.format(real_cjfee - txfee)) 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_cj_addr = 0
times_seen_change_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] order = [o for o in self.offerlist if o['oid'] == oid]
if len(order) == 0: if len(order) == 0:
fmt = 'didnt cancel order which doesnt exist, oid={}'.format fmt = 'didnt cancel order which doesnt exist, oid={}'.format
jlog.debug(fmt(oid)) jlog.info(fmt(oid))
self.offerlist.remove(order[0]) self.offerlist.remove(order[0])
if len(to_announce) > 0: if len(to_announce) > 0:
for ann in to_announce: for ann in to_announce:

28
jmclient/jmclient/taker.py

@ -128,7 +128,8 @@ class Taker(object):
#reset to satoshis #reset to satoshis
self.cjamount = int(self.cjamount * self.mixdepthbal) self.cjamount = int(self.cjamount * self.mixdepthbal)
if self.cjamount < jm_single().mincjamount: 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.cjamount = jm_single().mincjamount
self.n_counterparties = si[2] self.n_counterparties = si[2]
self.my_cj_addr = si[3] self.my_cj_addr = si[3]
@ -217,7 +218,7 @@ class Taker(object):
#txfee indicates undesirable behaviour on maker side anyway. #txfee indicates undesirable behaviour on maker side anyway.
self.total_txfee = 2 * self.txfee_default * self.n_counterparties self.total_txfee = 2 * self.txfee_default * self.n_counterparties
total_amount = self.cjamount + self.total_cj_fee + self.total_txfee 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: try:
self.input_utxos = self.wallet.select_utxos(self.mixdepth, self.input_utxos = self.wallet.select_utxos(self.mixdepth,
total_amount) total_amount)
@ -239,8 +240,8 @@ class Taker(object):
jlog.debug("Estimated outs: "+str(est_outs)) jlog.debug("Estimated outs: "+str(est_outs))
estimated_fee = estimate_tx_fee(est_ins, est_outs, estimated_fee = estimate_tx_fee(est_ins, est_outs,
txtype=self.wallet.get_txtype()) txtype=self.wallet.get_txtype())
jlog.info("We have a fee estimate: "+str(estimated_fee)) jlog.debug("We have a fee estimate: "+str(estimated_fee))
jlog.info("And a requested fee of: "+str( jlog.debug("And a requested fee of: "+str(
self.txfee_default * self.n_counterparties)) self.txfee_default * self.n_counterparties))
self.total_txfee = max([estimated_fee, self.total_txfee = max([estimated_fee,
self.n_counterparties * self.txfee_default]) self.n_counterparties * self.txfee_default])
@ -275,7 +276,8 @@ class Taker(object):
for nick, nickdata in ioauth_data.iteritems(): for nick, nickdata in ioauth_data.iteritems():
utxo_list, auth_pub, cj_addr, change_addr, btc_sig, maker_pk = nickdata utxo_list, auth_pub, cj_addr, change_addr, btc_sig, maker_pk = nickdata
if not self.auth_counterparty(btc_sig, auth_pub, maker_pk): 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 #This counterparty must be rejected
rejected_counterparties.append(nick) rejected_counterparties.append(nick)
@ -290,7 +292,7 @@ class Taker(object):
utxo_data = jm_single().bc_interface.query_utxo_set(self.utxos[ utxo_data = jm_single().bc_interface.query_utxo_set(self.utxos[
nick]) nick])
if None in utxo_data: 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))) 'utxo_data={}').format(pprint.pformat(utxo_data)))
# when internal reviewing of makers is created, add it here to # when internal reviewing of makers is created, add it here to
# immediately quit; currently, the timeout thread suffices. # immediately quit; currently, the timeout thread suffices.
@ -323,7 +325,7 @@ class Taker(object):
if change_amount < jm_single().DUST_THRESHOLD: if change_amount < jm_single().DUST_THRESHOLD:
fmt = ('ERROR counterparty requires sub-dust change. nick={}' fmt = ('ERROR counterparty requires sub-dust change. nick={}'
'totalin={:d} cjamount={:d} change={:d}').format '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) jlog.warn("Invalid change, too small, nick= " + nick)
continue continue
@ -331,7 +333,7 @@ class Taker(object):
'value': change_amount}) 'value': change_amount})
fmt = ('fee breakdown for {} totalin={:d} ' fmt = ('fee breakdown for {} totalin={:d} '
'cjamount={:d} txfee={:d} realcjfee={:d}').format '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)) nick]['txfee'], real_cjfee))
self.outputs.append({'address': cj_addr, 'value': self.cjamount}) self.outputs.append({'address': cj_addr, 'value': self.cjamount})
self.cjfee_total += real_cjfee self.cjfee_total += real_cjfee
@ -385,7 +387,7 @@ class Taker(object):
# seems you wont always get exactly zero because of integer # seems you wont always get exactly zero because of integer
# rounding so 1 satoshi extra or fewer being spent as miner # rounding so 1 satoshi extra or fewer being spent as miner
# fees is acceptable # fees is acceptable
jlog.debug(('WARNING CHANGE NOT BEING ' jlog.info(('WARNING CHANGE NOT BEING '
'USED\nCHANGEVALUE = {}').format(my_change_value)) 'USED\nCHANGEVALUE = {}').format(my_change_value))
else: else:
self.outputs.append({'address': self.my_change_addr, self.outputs.append({'address': self.my_change_addr,
@ -397,7 +399,7 @@ class Taker(object):
random.shuffle(self.utxo_tx) random.shuffle(self.utxo_tx)
random.shuffle(self.outputs) random.shuffle(self.outputs)
tx = btc.mktx(self.utxo_tx, 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) self.latest_tx = btc.deserialize(tx)
for index, ins in enumerate(self.latest_tx['ins']): for index, ins in enumerate(self.latest_tx['ins']):
@ -499,7 +501,7 @@ class Taker(object):
if not tx_signed: if not tx_signed:
return False return False
assert not len(self.nonrespondants) 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..") self.taker_info_callback("INFO", "Transaction is valid, signing..")
jlog.debug("schedule item was: " + str(self.schedule[self.schedule_index])) jlog.debug("schedule item was: " + str(self.schedule[self.schedule_index]))
return self.self_sign_and_push() return self.self_sign_and_push()
@ -651,7 +653,7 @@ class Taker(object):
tx = btc.serialize(self.latest_tx) tx = btc.serialize(self.latest_tx)
jlog.debug('\n' + tx) jlog.debug('\n' + tx)
self.txid = btc.txhash(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') tx_broadcast = jm_single().config.get('POLICY', 'tx_broadcast')
nick_to_use = None nick_to_use = None
if tx_broadcast == 'self': if tx_broadcast == 'self':
@ -686,7 +688,7 @@ class Taker(object):
return self.push() return self.push()
def unconfirm_callback(self, txd, txid): 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) #To allow client to mark transaction as "done" (e.g. by persisting state)
self.on_finished_callback(True, fromtx="unconfirmed") self.on_finished_callback(True, fromtx="unconfirmed")
self.waiting_for_conf = True self.waiting_for_conf = True

Loading…
Cancel
Save