Skip to content

Commit

Permalink
few typos corrected, and generic formatting (PEP 8)
Browse files Browse the repository at this point in the history
  • Loading branch information
cisba committed Sep 11, 2019
1 parent 56ad5d0 commit 00ab148
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
7 changes: 1 addition & 6 deletions otsserver/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def loop(self):
# the following raise an exception and block computation if the attestation does not verify
attested_time = attestation.verify_against_blockheader(key, block_header)
logging.debug("Verifying " + b2x(key) + " result " + str(attested_time))
break;
break
except Exception as err:
logging.info("%s - error contacting bitcoin node, sleeping..." % (err))
time.sleep(SLEEP_SECS)
Expand Down Expand Up @@ -333,8 +333,3 @@ def loop(self):

elapsed_time = time.time() - start_time
logging.info("Took %ds for %s" % (elapsed_time, str(backup_url)))





4 changes: 2 additions & 2 deletions otsserver/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,10 @@ def add_timestamps(self, new_timestamps):
if n % 10000 == 0:
now = time.time()
logging.debug("Added %d timestamps to LevelDB; %f stamps/second" %
(n, 10000.0 / (now - last)))
(n, 10000.0 / (now - last)))
last = now

self.db.Write(batch, sync = True)
self.db.Write(batch, sync=True)
logging.debug("Done LevelDbCalendar.add_timestamps(), added %d timestamps total" % n)

class Calendar:
Expand Down
2 changes: 1 addition & 1 deletion otsserver/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def do_GET(self):
a_week_ago = (datetime.date.today() - datetime.timedelta(days=7)).timetuple()
a_week_ago_posix = time.mktime(a_week_ago)
transactions_in_last_week = list(filter(lambda x: x["time"] > a_week_ago_posix, transactions))
fees_in_last_week = reduce(lambda a,b: a-b["fee"], transactions_in_last_week, 0)
fees_in_last_week = reduce(lambda a, b: a-b["fee"], transactions_in_last_week, 0)
try:
time_between_transactions = str(round(168 / len(transactions_in_last_week), 2)) # in hours based on 168 hours in a week
time_between_transactions += " hours"
Expand Down
9 changes: 4 additions & 5 deletions otsserver/stamper.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def make_btc_block_merkle_tree(blk_txids):
digests.append(digests[-1].msg)

next_level = []
for i in range(0,len(digests), 2):
for i in range(0, len(digests), 2):
next_level.append(cat_sha256d(digests[i], digests[i + 1]))

digests = next_level
Expand Down Expand Up @@ -181,7 +181,7 @@ def sort_filter_unspent(unspent):
return sorted(filter(lambda x: x['amount'] > DUST and x['spendable'], unspent),
key=lambda x: x['amount'])

unspent = sort_filter_unspent(listunspent(proxy,1))
unspent = sort_filter_unspent(listunspent(proxy, 1))

if len(unspent):
return unspent
Expand Down Expand Up @@ -391,7 +391,7 @@ def __do_bitcoin(self):
return

change_addr = proxy._call("getnewaddress", "", "bech32")
change_addr_info = proxy._call("getaddressinfo",change_addr)
change_addr_info = proxy._call("getaddressinfo", change_addr)
change_addr_script = x(change_addr_info['scriptPubKey'])

prev_tx = self.__create_new_timestamp_tx_template(unspent[-1]['outpoint'], unspent[-1]['amount'],
Expand Down Expand Up @@ -514,8 +514,7 @@ def is_pending(self, commitment):
return "Timestamped by transaction %s; waiting for %d confirmations"\
% (b2lx(ttx.tx.GetTxid()), self.min_confirmations-1)

else:
return False
return False

def __init__(self, calendar, exit_event, relay_feerate, min_confirmations, min_tx_interval, max_fee, max_pending):
self.calendar = calendar
Expand Down

0 comments on commit 00ab148

Please sign in to comment.