Module p2p_wire

Source
Expand description

Main module for the p2p chain. This is a blockchain provider, just like cli-chain, but it’s backed by p2p Bitcoin’s p2p network.

Modules§

address_man
Address manager is a module that keeps track of known peer addresses and associated metadata. This module is very important in keeping our node protected against targeted attacks, like eclipse attacks.
block_proof
This module defines the structures and methods for handling Utreexo proofs in the context of messaging in the bitcoin network.
error
node
Main file for this blockchain. A node is the central task that runs and handles important events, such as new blocks, peer connection/disconnection, new addresses, etc. A node should not care about peer-specific messages, peers’ll handle things like pings.
node_context
During the lifetime of a Bitcoin client, we have a couple of phases that are slightly different from each other, having to implement their own state-machines and logic for handing requests. While we could simply put everything in one struct and have a single impl block, that would create a massive amount of if’s in the code, taking different paths depending on which state are we in. For that reason, we define the basics of a node, like code shared by all the states into one base struct called UtreexoNode, we then further refine this struct using fine-tuned Contexts, that should implement NodeContext and are passed-in as a generic parameter by the caller.
node_interface
node_interface, which holds NodeInterface and related methods that define the API to interact with the floresta node
peer
socks
A wrapper around a TCP stream that handles the SOCKS5 handshake. This module only drives the handshake and returns the stream back to the caller. It does not perform any I/O on the stream after the handshake is complete. The caller is responsible for performing I/O on the stream. This module is built on top of the futures crate instead of an specific async runtime. This allows the caller to use this module with any async runtime they want.
transport

Structs§

UtreexoNodeConfig
Configuration for the Utreexo node.