memoriesadrift / tuw-cryptocurrencies-blockchain

Blockchain created for the Cryptocurrencies course at TU Wien
0 stars 0 forks source link

Connect to Peers and Discover New Peers #12

Closed memoriesadrift closed 11 months ago

memoriesadrift commented 11 months ago

Closes #6

Based on #10 for convenience

Features

  1. Connects to the bootstrap node, though it fails since it doesn't handshake yet.

  2. Keeps a list of connected peers I moved this entire thing to peerManager because the previous implementation of holding them in Network and then having the individual Peer stored in Network.peers call the network object to remove itself from the peers list looks like an awful practice.

  3. Persists a list of known peers Storing this in a file on disk, because the DB provided by the LV Leitung can only be instantiated once and by storing the peers as well as objects there we lose TS support, so I prefer this.
    This persists through docker-compose up and shutdowns, but is cleared on docker-compose build.

  4. Refactored the god-awful fake singleton classes to plain old JS objects It was getting on my nerves. Better to do it now before our code relies on this bad design pattern.