Fixes from PR review

This commit is contained in:
Salvatore Ingala
2019-10-10 10:34:03 +07:00
parent 831545ef2c
commit aea1d1f1e0
11 changed files with 43 additions and 44 deletions

View File

@@ -17,7 +17,7 @@ class BlockProcessor:
except JSONRPCException as e:
block = None
logger.error("couldn't get block from bitcoind.", error_code=e)
logger.error("Couldn't get block from bitcoind.", error_code=e)
return block
@@ -29,7 +29,7 @@ class BlockProcessor:
except JSONRPCException as e:
block_hash = None
logger.error("couldn't get block hash.", error_code=e)
logger.error("Couldn't get block hash.", error_code=e)
return block_hash
@@ -41,7 +41,7 @@ class BlockProcessor:
except JSONRPCException as e:
block_count = None
logger.error("couldn't get block block count", error_code=e)
logger.error("Couldn't get block count", error_code=e)
return block_count
@@ -57,10 +57,10 @@ class BlockProcessor:
potential_matches = {locator: potential_locators[locator] for locator in intersection}
if len(potential_matches) > 0:
logger.info("list of potential matches", potential_matches=potential_matches)
logger.info("List of potential matches", potential_matches=potential_matches)
else:
logger.info("no potential matches found")
logger.info("No potential matches found")
return potential_matches
@@ -76,12 +76,12 @@ class BlockProcessor:
justice_txid = bitcoin_cli.decoderawtransaction(justice_rawtx).get('txid')
matches.append((locator, uuid, dispute_txid, justice_txid, justice_rawtx))
logger.info("match found for locator.", locator=locator, uuid=uuid, justice_txid=justice_txid)
logger.info("Match found for locator.", locator=locator, uuid=uuid, justice_txid=justice_txid)
except JSONRPCException as e:
# Tx decode failed returns error code -22, maybe we should be more strict here. Leaving it simple
# for the POC
logger.error("can't build transaction from decoded data.", error_code=e)
logger.error("Can't build transaction from decoded data.", error_code=e)
return matches
@@ -93,7 +93,7 @@ class BlockProcessor:
if tx in tx_job_map and tx in unconfirmed_txs:
unconfirmed_txs.remove(tx)
logger.info("confirmation received for transaction", tx=tx)
logger.info("Confirmation received for transaction", tx=tx)
elif tx in unconfirmed_txs:
if tx in missed_confirmations:
@@ -102,6 +102,6 @@ class BlockProcessor:
else:
missed_confirmations[tx] = 1
logger.info("transaction missed a confirmation", tx=tx, missed_confirmations=missed_confirmations[tx])
logger.info("Transaction missed a confirmation", tx=tx, missed_confirmations=missed_confirmations[tx])
return unconfirmed_txs, missed_confirmations