Skip to content

Commit

Permalink
Prevents startup/testnet spam to log.
Browse files Browse the repository at this point in the history
  • Loading branch information
haarts committed Jul 4, 2015
1 parent 9ebbb24 commit 74b933e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions yield-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#spent from utxos that try to make the highest balance even higher
# so try to keep coins concentrated in one mixing depth
class YieldGenerator(Maker):
statement_file = os.path.join('logs', 'yigen-statement.csv')

def __init__(self, msgchan, wallet):
Maker.__init__(self, msgchan, wallet)
Expand All @@ -39,17 +40,22 @@ def __init__(self, msgchan, wallet):
self.tx_unconfirm_timestamp = {}

def log_statement(self, data):
if common.get_network() == 'testnet':
return

data = [str(d) for d in data]
self.income_statement = open(os.path.join('logs',
'yigen-statement.csv'), 'aw')
self.income_statement = open(statement_file, 'a')
self.income_statement.write(','.join(data) + '\n')
self.income_statement.close()

def on_welcome(self):
Maker.on_welcome(self)
self.log_statement(['timestamp', 'cj amount/satoshi', 'my input count',
'my input value/satoshi', 'cjfee/satoshi',
'earned/satoshi', 'confirm time/min', 'notes'])
if not os.path.isfile(statement_file):
self.log_statement(
['timestamp', 'cj amount/satoshi', 'my input count',
'my input value/satoshi', 'cjfee/satoshi', 'earned/satoshi',
'confirm time/min', 'notes'])

timestamp = datetime.datetime.now().strftime("%Y/%m/%d %H:%M:%S")
self.log_statement([timestamp, '', '', '', '', '', '', 'Connected'])

Expand Down

0 comments on commit 74b933e

Please sign in to comment.