Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2023-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#ifndef BITCOIN_COMMON_INIT_H6#define BITCOIN_COMMON_INIT_H8#include <util/translation.h>10#include <functional>11#include <optional>12#include <string>13#include <vector>15class ArgsManager;17namespace common {18enum class ConfigStatus {19FAILED, //!< Failed generically.20FAILED_WRITE, //!< Failed to write settings.json21ABORTED, //!< Aborted by user22};24struct ConfigError {25ConfigStatus status;26bilingual_str message{};27std::vector<std::string> details{};28};30//! Callback function to let the user decide whether to abort loading if31//! settings.json file exists and can't be parsed, or to ignore the error and32//! overwrite the file.33using SettingsAbortFn = std::function<bool(const bilingual_str& message, const std::vector<std::string>& details)>;35/* Read config files, and create datadir and settings.json if they don't exist. */36std::optional<ConfigError> InitConfig(ArgsManager& args, SettingsAbortFn settings_abort_fn = nullptr);37} // namespace common39#endif // BITCOIN_COMMON_INIT_H