Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -407,9 +407,11 @@ def get_my_chain_send(sender_name=None):
|
|
407 |
|
408 |
try:
|
409 |
r = requests.get(f'{main_balance}{sender_name}.json')
|
|
|
410 |
mychain_send = MyChain(chain_load=main_balance,load=r.text)
|
411 |
response = {'chain': mychain_send.chain,
|
412 |
'length': len(mychain_send.chain)}
|
|
|
413 |
message = f"Blockchain loaded from: {main_balance}{sender_name}.json"
|
414 |
return response,message
|
415 |
except:
|
@@ -437,28 +439,7 @@ def get_my_chain_rec(recipient_name=None):
|
|
437 |
message = f"Error loading from: {recipient_name}"
|
438 |
return ["Error Loading Chain"],message
|
439 |
|
440 |
-
|
441 |
-
mes, out, balance_send, balance_rec = issue_tokens(sender,recipient,amount)
|
442 |
-
if out == True:
|
443 |
-
mychain_send.new_transaction(f"{sender}",f"{recipient}",f"{amount}",f"{balance_send}")
|
444 |
-
message = "Transaction Added to Pool"
|
445 |
-
data = pd.DataFrame(mychain_send.pending_transactions)
|
446 |
-
if out == False:
|
447 |
-
message = mes
|
448 |
-
data = None
|
449 |
-
return data,message,None,None,None
|
450 |
-
|
451 |
-
def mychain_transaction_rec(sender,recipient,amount):
|
452 |
-
mes, out, balance_send, balance_rec = issue_tokens(sender,recipient,amount)
|
453 |
-
if out == True:
|
454 |
-
mychain_rec.new_transaction(f"{sender}",f"{recipient}",f"{amount}",f"{balance_rec}")
|
455 |
-
message = "Transaction Added to Pool"
|
456 |
-
data = pd.DataFrame(mychain_rec.pending_transactions)
|
457 |
-
if out == False:
|
458 |
-
message = mes
|
459 |
-
data = None
|
460 |
-
return data,message,None,None,None
|
461 |
-
|
462 |
def mychain_mine_block_send(balance, chain_r=None,chain_n=None):
|
463 |
previous_block = mychain_send.print_previous_block()
|
464 |
previous_proof = previous_block['proof']
|
|
|
407 |
|
408 |
try:
|
409 |
r = requests.get(f'{main_balance}{sender_name}.json')
|
410 |
+
print (f'r={r}')
|
411 |
mychain_send = MyChain(chain_load=main_balance,load=r.text)
|
412 |
response = {'chain': mychain_send.chain,
|
413 |
'length': len(mychain_send.chain)}
|
414 |
+
print (response)
|
415 |
message = f"Blockchain loaded from: {main_balance}{sender_name}.json"
|
416 |
return response,message
|
417 |
except:
|
|
|
439 |
message = f"Error loading from: {recipient_name}"
|
440 |
return ["Error Loading Chain"],message
|
441 |
|
442 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
443 |
def mychain_mine_block_send(balance, chain_r=None,chain_n=None):
|
444 |
previous_block = mychain_send.print_previous_block()
|
445 |
previous_proof = previous_block['proof']
|