Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
1a91e21
fix(genesis_block): transactions as array
Nov 2, 2019
a78b8e4
add(base ihm)
Nov 2, 2019
e8e52aa
fix(blockchain): check if transaction signature valid and stock valid
mxmaxime Nov 5, 2019
10c5912
Merge branch 'master' into blockchain_network_integration
mxmaxime Nov 5, 2019
c02f0b9
feat(network_integration): send real things.
mxmaxime Nov 5, 2019
060902f
Change Messages
mxmaxime Nov 5, 2019
66d9a30
feat(blockchain): initialize blockchain when a new node connect
Nov 5, 2019
ec19064
add ask chain when we are connected
soso0084 Nov 5, 2019
36007b5
wip fix init bc
mxmaxime Nov 5, 2019
6d0a84e
up size of buffer
soso0084 Nov 5, 2019
1007821
same
soso0084 Nov 5, 2019
7714692
wip debug
mxmaxime Nov 5, 2019
14dd356
feat(integration of mine)
mxmaxime Nov 5, 2019
bcd0f45
fix ask chain
soso0084 Nov 5, 2019
cc1e51d
same
soso0084 Nov 5, 2019
ff09174
wip debug block broadcast
mxmaxime Nov 5, 2019
010fdde
wip debug
mxmaxime Nov 5, 2019
9753b12
wip tests(blockchain): genesis block
mxmaxime Nov 5, 2019
1291aad
Merge branch 'master' into blockchain_network_integration
mxmaxime Nov 5, 2019
1ad5d99
Auto stash before merge of "blockchain_network_integration" and "orig…
soso0084 Nov 5, 2019
7ed84d8
fix(blockchain): broadcast block
mxmaxime Nov 5, 2019
0830b5c
Merge remote-tracking branch 'origin/blockchain_network_integration' …
mxmaxime Nov 5, 2019
344cefb
wip debug
mxmaxime Nov 5, 2019
0c273e0
fix(blockchain): handle block that I already have
mxmaxime Nov 6, 2019
5596dbd
fix prev commit
mxmaxime Nov 6, 2019
4a6fa71
add two other node to ping when we are online
soso0084 Nov 6, 2019
cdbb5ca
Auto stash before merge of "blockchain_network_integration" and "orig…
Nov 6, 2019
bece209
Merge branch 'master' into ihm
Nov 6, 2019
87fba19
fix(test): blockchain
Nov 6, 2019
e899f6e
Merge branch 'ihm' into blockchain_network_integration
Nov 6, 2019
abd46ac
ihm
Nov 6, 2019
a723a9f
add IP in list
soso0084 Nov 6, 2019
a7c8940
Merge remote-tracking branch 'origin/blockchain_network_integration' …
soso0084 Nov 6, 2019
5cee766
delete some line
soso0084 Nov 6, 2019
ca9c241
wip app
Nov 6, 2019
215769e
Merge remote-tracking branch 'origin/blockchain_network_integration' …
Nov 6, 2019
457bb06
same
soso0084 Nov 6, 2019
cd1b61a
Merge remote-tracking branch 'origin/blockchain_network_integration' …
Nov 6, 2019
bd529cf
wip network
Nov 6, 2019
1fc5116
fix network
Nov 6, 2019
3993fa1
wip ihm
Nov 6, 2019
c953a27
same
soso0084 Nov 6, 2019
24c035e
imgs
Lonaeri Nov 6, 2019
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
Prev Previous commit
Next Next commit
wip tests(blockchain): genesis block
  • Loading branch information
mxmaxime committed Nov 5, 2019
commit 9753b120f9b62d7c090424f936c3edfffebeb065
17 changes: 9 additions & 8 deletions network/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@

class Network:

def __init__(self):
self.node = Node("192.168.1.82", True)
def __init__(self, test=False):
self.node = Node("192.168.1.62", True)
self.nodes = []
self.blockchain = None

# Thread management
self._running = True
self.t1 = threading.Thread(target=self.receiv)
self.t1.start()
self._broadcast_ping()
if test is False:
# Thread management
self._running = True
self.t1 = threading.Thread(target=self.receiv)
self.t1.start()
self._broadcast_ping()

def stop(self):
self._running = False
Expand All @@ -36,7 +37,7 @@ def broadcast_ask_chain(self): # Done
self.node.send("-c ", nodeList, "")

def _broadcast_ping(self): #Done
nodeBroadcast = Node("192.168.1.62")
nodeBroadcast = Node("192.168.1.82")
myNodeToSend = jsonpickle.encode(self.node)
self.node.send("-p ", nodeBroadcast, myNodeToSend)

Expand Down
9 changes: 8 additions & 1 deletion test_blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@
from client import Client
from init_transactions import hashImg
from transaction import Transaction
from block import Block, HASH_GENESIS_BLOCK
from network.network import Network

network = Network(True)

from init_datas import creator_address

blockchain = Blockchain()
blockchain = Blockchain(network)

wallet = Wallet()
guy_wallet = Wallet(1024, True)

def test_genesis_block():
assert Block.hash(blockchain.chain[0]) == HASH_GENESIS_BLOCK

def test_submit_transaction():
transaction = Client.generate_transaction(
wallet, guy_wallet.address, 10)
Expand Down