mirror of
https://github.com/aljazceru/python-teos.git
synced 2026-01-24 08:44:26 +01:00
Update logging levels
This commit is contained in:
@@ -73,7 +73,7 @@ class Responder:
|
|||||||
elif e.code == RPC_VERIFY_ALREADY_IN_CHAIN:
|
elif e.code == RPC_VERIFY_ALREADY_IN_CHAIN:
|
||||||
try:
|
try:
|
||||||
if debug:
|
if debug:
|
||||||
logging.error("[Responder] {} is already in the blockchain. Getting the confirmation count"
|
logging.info("[Responder] {} is already in the blockchain. Getting the confirmation count"
|
||||||
"and start monitoring the transaction".format(txid))
|
"and start monitoring the transaction".format(txid))
|
||||||
|
|
||||||
# If the transaction is already in the chain, we get the number of confirmations and watch the job
|
# If the transaction is already in the chain, we get the number of confirmations and watch the job
|
||||||
@@ -139,7 +139,7 @@ class Responder:
|
|||||||
self.add_response(self.jobs[job_id].dispute_txid, job_id, self.jobs[job_id].tx,
|
self.add_response(self.jobs[job_id].dispute_txid, job_id, self.jobs[job_id].tx,
|
||||||
self.jobs[job_id].appointment_end, debug, logging, retry=True)
|
self.jobs[job_id].appointment_end, debug, logging, retry=True)
|
||||||
if debug:
|
if debug:
|
||||||
logging.info("[Responder] txid = {} has missed {} confirmations. Rebroadcast"
|
logging.warning("[Responder] txid = {} has missed {} confirmations. Rebroadcasting"
|
||||||
.format(job_id, CONFIRMATIONS_BEFORE_RETRY))
|
.format(job_id, CONFIRMATIONS_BEFORE_RETRY))
|
||||||
else:
|
else:
|
||||||
# Otherwise we increase the number of missed confirmations
|
# Otherwise we increase the number of missed confirmations
|
||||||
@@ -164,7 +164,7 @@ class Responder:
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
if debug:
|
if debug:
|
||||||
logging.error("[Responder] reorg found! local prev. block id = {}, remote prev. block id = {}"
|
logging.warning("[Responder] reorg found! local prev. block id = {}, remote prev. block id = {}"
|
||||||
.format(prev_block_hash, block.get('previousblockhash')))
|
.format(prev_block_hash, block.get('previousblockhash')))
|
||||||
|
|
||||||
self.handle_reorgs(bitcoin_cli, debug, logging)
|
self.handle_reorgs(bitcoin_cli, debug, logging)
|
||||||
@@ -176,7 +176,7 @@ class Responder:
|
|||||||
self.zmq_subscriber.terminate = True
|
self.zmq_subscriber.terminate = True
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
logging.error("[Responder] no more pending jobs, going back to sleep.")
|
logging.info("[Responder] no more pending jobs, going back to sleep.")
|
||||||
|
|
||||||
def handle_reorgs(self, bitcoin_cli, debug, logging):
|
def handle_reorgs(self, bitcoin_cli, debug, logging):
|
||||||
for job_id, job in self.jobs.items():
|
for job_id, job in self.jobs.items():
|
||||||
@@ -187,7 +187,7 @@ class Responder:
|
|||||||
except JSONRPCException as e:
|
except JSONRPCException as e:
|
||||||
# FIXME: It should be safe but check Exception code anyway
|
# FIXME: It should be safe but check Exception code anyway
|
||||||
if debug:
|
if debug:
|
||||||
logging.error("[Responder] justice transaction (txid = {}) not found!".format(job_id))
|
logging.warning("[Responder] justice transaction (txid = {}) not found!".format(job_id))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
bitcoin_cli.gettransaction(job.dispute_txid)
|
bitcoin_cli.gettransaction(job.dispute_txid)
|
||||||
@@ -196,7 +196,7 @@ class Responder:
|
|||||||
except JSONRPCException as e:
|
except JSONRPCException as e:
|
||||||
# FIXME: It should be safe but check Exception code anyway
|
# FIXME: It should be safe but check Exception code anyway
|
||||||
if debug:
|
if debug:
|
||||||
logging.error("[Responder] dispute transaction (txid = {}) not found either!"
|
logging.warning("[Responder] dispute transaction (txid = {}) not found either!"
|
||||||
.format(job.dispute_txid))
|
.format(job.dispute_txid))
|
||||||
|
|
||||||
# ToDO: Dispute transaction is not there either, call reorg manager
|
# ToDO: Dispute transaction is not there either, call reorg manager
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class Watcher:
|
|||||||
|
|
||||||
for locator, appointment_pos, dispute_txid, txid, rawtx in matches:
|
for locator, appointment_pos, dispute_txid, txid, rawtx in matches:
|
||||||
if debug:
|
if debug:
|
||||||
logging.error("[Watcher] notifying responder about {}:{} and deleting appointment".format(
|
logging.info("[Watcher] notifying responder about {}:{} and deleting appointment".format(
|
||||||
locator, appointment_pos))
|
locator, appointment_pos))
|
||||||
|
|
||||||
responder.add_response(dispute_txid, txid, rawtx,
|
responder.add_response(dispute_txid, txid, rawtx,
|
||||||
@@ -110,7 +110,7 @@ class Watcher:
|
|||||||
|
|
||||||
except JSONRPCException as e:
|
except JSONRPCException as e:
|
||||||
if debug:
|
if debug:
|
||||||
logging.error("[Watcher] JSONRPCException. Error code {}".format(e))
|
logging.info("[Watcher] JSONRPCException. Error code {}".format(e))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Go back to sleep if there are no more appointments
|
# Go back to sleep if there are no more appointments
|
||||||
@@ -132,7 +132,7 @@ class Watcher:
|
|||||||
matches.append((locator, appointment_pos, dispute_txid, txid, raw_tx))
|
matches.append((locator, appointment_pos, dispute_txid, txid, raw_tx))
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
logging.error("[Watcher] match found for {}:{}! {}".format(locator, appointment_pos,
|
logging.info("[Watcher] match found for {}:{}! {}".format(locator, appointment_pos,
|
||||||
dispute_txid))
|
dispute_txid))
|
||||||
except JSONRPCException as e:
|
except JSONRPCException as e:
|
||||||
# Tx decode failed returns error code -22, maybe we should be more strict here. Leaving it simple
|
# Tx decode failed returns error code -22, maybe we should be more strict here. Leaving it simple
|
||||||
|
|||||||
Reference in New Issue
Block a user