Skip to content

Commit

Permalink
Some refactoring and addition of transaction list page.
Browse files Browse the repository at this point in the history
The site now includes a page at /transactions which list all
previously sent donations from the site. This commit also adds
a standalone script to allow people to independently audit
generated addresses and the payments from them.
  • Loading branch information
DonnchaC committed Sep 28, 2014
1 parent 9ad26a9 commit af520a1
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 256 deletions.
6 changes: 4 additions & 2 deletions main.py
Expand Up @@ -12,6 +12,8 @@ def create_option_parser():
help="download details.json from Onionoo service")
parser.add_option("-c", "--check", action="store_true",
help="check bitcoin addresses for unspent outputs")
parser.add_option("-a", "--check-all", action="store_true", default=False,
help="check all bitcoin addresses for unspent outputs including old addresses")
return parser

if '__main__' == __name__:
Expand All @@ -24,9 +26,9 @@ def create_option_parser():
print "Downloaded details.json. Re-run without --download option."
exit()

elif options.check:
elif options.check or options.check_all:
# Check recent bitcoin addresses for unspent outputs
successful_transactions = oniontip.views.find_unsent_payments()
successful_transactions = oniontip.views.find_unsent_payments(check_all=options.check_all)
if successful_transactions:
print '{} transactions were successfully sent:'.format(len(successful_transactions))
for tx in successful_transactions:
Expand Down
3 changes: 2 additions & 1 deletion oniontip/models.py
Expand Up @@ -13,7 +13,8 @@ class ForwardAddress(db.Model):
outputs = db.Column(db.PickleType, nullable=False)
created = db.Column(db.DateTime)
spent = db.Column(db.Boolean, default=False)
expired = db.Column(db.Boolean, default=False)
spending_tx = db.Column(db.String(80))
donation_amount = db.Column(db.Integer)

def __init__(self, private_key=None, outputs=None, previous_n=0):
if not private_key:
Expand Down
15 changes: 14 additions & 1 deletion oniontip/static/css/style.css
Expand Up @@ -7,6 +7,11 @@
max-width: 120px;
}

#donate-checkbox-label {
padding-left: 0px;
font-weight: bold;
}

#torproj-donate {
max-width: 190px;
}
Expand All @@ -23,7 +28,7 @@
padding-bottom: 100px;
}

#result_table td, #result_table th {
#result_table td, #result_table th, #transactionlisting td, #transactionlisting th {
text-align: center;
}

Expand All @@ -50,6 +55,10 @@ th.spinner-small {
margin-bottom: 30px;
}

#page-title a {
color: #333333;
}

#flag-options {
margin: 10px;
}
Expand Down Expand Up @@ -83,6 +92,10 @@ th.spinner-small {
margin-top: 10px;
}

#donated-total{
font-weight: bold;
}


/* Sticky footer styles
-------------------------------------------------- */
Expand Down
Binary file modified oniontip/static/img/cc/fr.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions oniontip/static/js/angularize.js
Expand Up @@ -104,6 +104,7 @@ oniontipModule.controller('OnionTipCtrl',function OnionTipCtrl($scope,$http,$loc
.success(function(response) {
if (response.data.bitcoin_address) {
$scope.payment_address = response.data.bitcoin_address
$scope.num_unique_addresses = response.data.num_unique_addresses
$scope.state = "loaded"
if (success_pay != null){
success_pay()
Expand Down
228 changes: 0 additions & 228 deletions oniontip/templates/index.html

This file was deleted.

9 changes: 9 additions & 0 deletions oniontip/util.py
Expand Up @@ -156,6 +156,15 @@ def calculate_fee(num_inputs, num_outputs, kb_tx_fee):
estimate_size = float((148 * num_inputs) + (34 * num_outputs) + 10)
return int(math.ceil(estimate_size / 1000) * kb_tx_fee)

def format_bitcoin_value(value):
if value:
if int(value) >= 100000000: # More than 1 BTC
return "%.2f BTC" % (float(value) / 100000000)
else:
return "%.2f mBTC" % (float(value) / 100000)
else:
return '0 mBTC'

class BaseFilter(object):
def accept(self, relay):
raise NotImplementedError("This isn't implemented by the subclass")
Expand Down

0 comments on commit af520a1

Please sign in to comment.