1
Fork 0
mirror of https://github.com/Steffo99/greed.git synced 2025-03-13 12:17:27 +00:00

remove unneccesary satoshi

This commit is contained in:
Darren 2020-01-29 14:48:18 +02:00
parent f5867405af
commit 1bcb243337
2 changed files with 2 additions and 5 deletions

View file

@ -159,7 +159,7 @@ def callback():
# Convert satoshi to fiat
satoshi = float(flask.request.args.get("value"))
received_btc = satoshi/1.0e8
received_value = received_btc*transaction.price
received_value = round(received_btc*transaction.price, 2)
print ("Recieved "+str(received_value)+" "+configloader.config["Payments"]["currency"]+" on address "+address)
# Add the credit to the user account
user = dbsession.query(db.User).filter(db.User.user_id == transaction.user_id).one_or_none()

View file

@ -281,13 +281,12 @@ class ChatWorker(threading.Thread):
if status >= 0:
# Convert satoshi to fiat
received_btc = value/1.0e8
received_value = received_btc*transaction.price
received_value = round(received_btc*transaction.price, 2)
# Add the credit to the user account
user = self.session.query(db.User).filter(db.User.user_id == transaction.user_id).one_or_none()
user.credit += received_value
# Update the value + status + timestamp for transaction in DB
transaction.satoshi = value
transaction.value += received_value
transaction.status = 2
# Add a transaction to list
@ -836,7 +835,6 @@ class ChatWorker(threading.Thread):
btc_address = transaction.address
# Update btc_price, satoshi, currency, timestamp
transaction.btc_price = btc_price
transaction.satoshi = satoshi_amount
transaction.currency = configloader.config["Payments"]["currency"]
transaction.timestamp = datetime.datetime.now()
else:
@ -845,7 +843,6 @@ class ChatWorker(threading.Thread):
new_transaction = db.BtcTransaction(user=self.user,
price = btc_price,
value=0,
satoshi = satoshi_amount,
currency = configloader.config["Payments"]["currency"],
status = -1,
timestamp = datetime.datetime.now(),