Skip to content
This repository has been archived by the owner on Feb 21, 2022. It is now read-only.

time problem fixed #191

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tickets/.pass
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"address":"1e264979ee1de3aa23e9c57f3c4d2e8dd4142549","crypto":{"cipher":"aes-128-ctr","ciphertext":"7f2c7a94a82f3bf0d01bd602684891c7267d33defe3cbc8d0b941c1a19a9ffc9","cipherparams":{"iv":"35f46e23113e898a86d1d543f4336666"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"f28a43ab183ca8fad14d7842486983eda4fe1b4a25eedecfc81c7249eae5f33b"},"mac":"983913b9ee5795d3f05f8e54b337b633504329a93bc0e19b1db146e177b2620e"},"id":"e73168ac-86a3-4b78-b5b6-26a09fe6636d","version":3}
{"address":"a832ac7b2e2e5bf8809dac391cd7a8076877b85b","crypto":{"cipher":"aes-128-ctr","ciphertext":"4fe62c61cc82eb20c3635e715c16299b26c67ca78db269bc0d6cb0be6eb16821","cipherparams":{"iv":"42d842b7dd96d092a7cdebd9b73a2b84"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"a3231f017959470f2c9db6ec6714d9d1435f3dce98d4fbe699ea5b9c1dc62669"},"mac":"2fb95cc9c5e3bfcc76ac8c958b262498f1332847bdba6a787ee18a5ecb809794"},"id":"a5436e63-163f-45a6-a199-c2fc2a54a676","version":3}
4 changes: 2 additions & 2 deletions tickets/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def default(self, obj):
def sendData(accessKey):

# Preparamos la transaccion
nonce = w3.eth.getTransactionCount(w3.toChecksumAddress("0x1e264979ee1de3aa23e9c57f3c4d2e8dd4142549"))
params = {'accessKey': accessKey, 'address':w3.toChecksumAddress("0x1e264979ee1de3aa23e9c57f3c4d2e8dd4142549"), 'nonce':nonce}
nonce = w3.eth.getTransactionCount(w3.toChecksumAddress("0xa832ac7b2e2e5bf8809dac391cd7a8076877b85b"))
params = {'accessKey': accessKey, 'address':w3.toChecksumAddress("0xa832ac7b2e2e5bf8809dac391cd7a8076877b85b"), 'nonce':nonce}
res = requests.post('http://138.100.10.226:4040/prepareTx', data=params)
tx = json.loads(res.text)

Expand Down
22 changes: 16 additions & 6 deletions tickets/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@

from TryIT.url_helper import create_context

from queue import Queue
from threading import Thread

# Blockchain thread
queue = Queue()

def blockchainSend():
while True:
accessKey = queue.get()
sendData(accessKey)

thread = Thread(target=blockchainSend)
thread.start()


def tickets(request):
return render(request, template_name='tickets/tickets.html', context=create_context())
Expand Down Expand Up @@ -142,16 +156,12 @@ def validate_ticket(request):
checkin.validator = validator
try:
checkin.save(ticket)
# Queue blockchain request
queue.put(ticket.signature)
except:
# Checkin already registered, ignore
pass

try:
#sendData(ticket.signature)
pass
except:
pass

return HttpResponse('true')
else:
return HttpResponseNotAllowed(permitted_methods=['POST'])