Bitcoin Core 28.99.0
P2P Digital Currency
init.h
Go to the documentation of this file.
1// Copyright (c) 2023 The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#ifndef BITCOIN_COMMON_INIT_H
6#define BITCOIN_COMMON_INIT_H
7
8#include <util/translation.h>
9
10#include <functional>
11#include <optional>
12#include <string>
13#include <vector>
14
15class ArgsManager;
16
17namespace common {
18enum class ConfigStatus {
19 FAILED,
21 ABORTED,
22};
23
27 std::vector<std::string> details{};
28};
29
33using SettingsAbortFn = std::function<bool(const bilingual_str& message, const std::vector<std::string>& details)>;
34
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 common
38
39#endif // BITCOIN_COMMON_INIT_H
ArgsManager & args
Definition: bitcoind.cpp:277
Definition: args.cpp:868
ConfigStatus
Definition: init.h:18
@ ABORTED
Aborted by user.
@ FAILED_WRITE
Failed to write settings.json.
@ FAILED
Failed generically.
std::function< bool(const bilingual_str &message, const std::vector< std::string > &details)> SettingsAbortFn
Callback function to let the user decide whether to abort loading if settings.json file exists and ca...
Definition: init.h:33
std::optional< ConfigError > InitConfig(ArgsManager &args, SettingsAbortFn settings_abort_fn)
Definition: init.cpp:18
Bilingual messages:
Definition: translation.h:21
bilingual_str message
Definition: init.h:26
std::vector< std::string > details
Definition: init.h:27
ConfigStatus status
Definition: init.h:25