From 4db46705fbe7577cf7f31afe9e74689be84a98ce Mon Sep 17 00:00:00 2001 From: Spekulaas <“ryan@aterve.nl”> Date: Wed, 3 Jan 2024 20:26:37 +0100 Subject: [PATCH] ex 3 --- period_2/02-sockets/903/Miner_a.py | 8 ++++---- period_2/02-sockets/903/Wallet_t.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/period_2/02-sockets/903/Miner_a.py b/period_2/02-sockets/903/Miner_a.py index e36c03f..0ad16c7 100644 --- a/period_2/02-sockets/903/Miner_a.py +++ b/period_2/02-sockets/903/Miner_a.py @@ -1,8 +1,7 @@ from SocketUtil import * -import TxBlock as Tx -# import Tx - +from TxBlock import TxBlock +from Transaction import Tx SERVER = 'localhost' wallet_list = [SERVER] @@ -14,6 +13,7 @@ def minerServer(my_ip, wallet_list): # receive 2 transactions for i in range(10): newTx = recvObj(miner_server_socket) + print(len(newTx)) if isinstance(newTx, Tx): tx_list.append(newTx) print("Received Tx") @@ -78,7 +78,7 @@ def minerServer(my_ip, wallet_list): block.find_nonce() # send that block to each in wallet_list for wallet in wallet_list: - sendObj(wallet, block) + sendObj(wallet, block, 5006) return diff --git a/period_2/02-sockets/903/Wallet_t.py b/period_2/02-sockets/903/Wallet_t.py index 13b7bae..a021410 100644 --- a/period_2/02-sockets/903/Wallet_t.py +++ b/period_2/02-sockets/903/Wallet_t.py @@ -3,7 +3,7 @@ from Transaction import * from Signature import * M_SERVER_IP = 'localhost' -M_SERVER_PORT = 5005 +M_SERVER_PORT = 5050 W_SERVER_IP = 'localhost' W_SERVER_PORT = 5006 @@ -31,7 +31,7 @@ print(Tx1.is_valid()) print(Tx2.is_valid()) try: - sendObj(M_SERVER_IP, Tx1, M_SERVER_PORT) + # sendObj(M_SERVER_IP, Tx1, M_SERVER_PORT) print("Sent Tx1") sendObj(M_SERVER_IP, Tx2, M_SERVER_PORT) print("Sent Tx2")