ex 3
This commit is contained in:
parent
cb70a03d81
commit
4db46705fb
@ -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
|
||||
|
||||
|
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user