Bitcoin full node and query server

May 6, 2024

View in context in the libbitcoin Slack #general mirror.

evoskuil00:26
The node object doesn't have the ability to stop itself, which is intentional - sort of a design forcing function. The node (console process) stops the node via keyboard command. This forces the implementation to deal rationally with things like network disconnect, disk full, and store corruption (for example). When reviewing the handling of store corruption and disk full I decided that it would be good to slightly modify the libbitcoin-network stack to enable connect/accept suspension. Normally the connectors are allocated at startup and run in a callback loop, always attempting to maintain the configured number of connections. But for both backup and store full/fault conditions, we need to suspend this. So I made those modifications, which were simple. The connector and acceptor classes are now constructed with a reference to an atomic bool, owned by p2p. This tells them to bypass connection attempts with a specific error code. Since certain errors result in a delayed retry (precluding tight loops on things like no internet or no addresses), this fits naturally into the design.