Published on May 16th, 2018 | by bitcoin0
Fortifying Our Bitcoin Node with Connection
We left off in our Bitcoin adventure by building a bare-bones Bitcoin node that connects to another peer node on the network.
Today we’ll be refactoring our Bitcoin node to use James Fish’s Connection behavior, rather than the basic GenServer behavior that ships with Elixir.
Implementing this behavior in our node will give us more robustness in our connection process, along with the option to reconnect to a peer node in the case of failure.
Our Starting Point
Before we dive into refactoring our Bitcoin node to use the new Connection behavior, we should go over some changes I made to simplify the BitcoinNetwork.Node module.
Now our Bitcoin node will stop attempting to connect to its peer node after three failed attempts, waiting one second between each.