Skip to content

Commit e8c71ce

Browse files
2eef89c merge bitcoin#27317: Check that the timestamp string is non-empty to avoid undefined behavior (Kittywhiskers Van Gogh) de6c0ae merge bitcoin#27189: Use steady clock in SeedStrengthen, FindBestImplementation, FlushStateToDisk (Kittywhiskers Van Gogh) 5bed6ea merge bitcoin#27016: require miniupnpc API version 17 or later (Kittywhiskers Van Gogh) 51a9f24 merge bitcoin#23395: Add -shutdownnotify option (Kittywhiskers Van Gogh) af0e14d merge bitcoin#26723: call `keypoolrefill` with priv key disabled should throw an error (Kittywhiskers Van Gogh) b91c5b9 merge bitcoin#22949: Round up fee calculation to avoid a lower than expected feerate (Kittywhiskers Van Gogh) 05fb900 merge bitcoin#25815: Use existing {Chainstate,Block}Man (Kittywhiskers Van Gogh) 945798c merge bitcoin#24462: For descriptor pubkey parse errors, include context information (Kittywhiskers Van Gogh) 033e060 merge bitcoin#26673: Remove confusing getBool method (Kittywhiskers Van Gogh) 37ca4b4 merge bitcoin#26894: Remove redundant key_to_p2pkh call (Kittywhiskers Van Gogh) 2b3f925 merge bitcoin#26624: Rename local variable to distinguish it from type alias (Kittywhiskers Van Gogh) 3a58533 merge bitcoin#25315: Add warning on first startup if free disk space is less than necessary (Kittywhiskers Van Gogh) adeebb0 merge bitcoin#24051: bitcoin-{cli,tx,util} don't need UPnP, NAT-PMP, or ZMQ (Kittywhiskers Van Gogh) 55a474f merge bitcoin#25863: remove unused norm_prv parameter in `descriptor_tests.cpp` (Kittywhiskers Van Gogh) 65299a0 merge bitcoin#25748: Avoid copies in FlatSigningProvider Merge (Kittywhiskers Van Gogh) 5d69d18 merge bitcoin#15936: Expose settings.json methods to GUI (Kittywhiskers Van Gogh) bdf5e92 merge bitcoin#24410: Split hashing/index `GetUTXOStats` codepaths, decouple from `coinstatsindex` (Kittywhiskers Van Gogh) 43e2a19 merge bitcoin#23345: Drop unneeded dependencies for bitcoin-wallet tool (Kittywhiskers Van Gogh) Pull request description: ## Additional Information * The minimum acceptable prune height in [bitcoin#25315](bitcoin#25315) is higher than upstream (`945` vs `550`) because minimum height is calculated using `MIN_DISK_SPACE_FOR_BLOCK_FILES` which was bumped in [dash#1621](#1621), this has been reflected in functional tests. * [bitcoin#27016](bitcoin#27016) raises the minimum miniupnpc version to v2.1. This is acceptable as depends already uses version v2.2.2 ([source](https://github.com/dashpay/dash/blob/f7dad69eab573c179060ff9eb1bbaccb317de6d3/depends/packages/miniupnpc.mk#L2)) and our minimum supported target based on glibc version (see description of [dash#6382](#6382)), Ubuntu 20.04 LTS ([source](https://launchpad.net/ubuntu/+source/miniupnpc/2.1.20190824-0ubuntu2)) and RHEL 9 ([source](https://rpmfind.net/linux/RPM/epel/9/x86_64/Packages/m/miniupnpc-2.2.4-2.el9.x86_64.html)) ship with the minimum required miniupnpc version or higher. * [bitcoin#24462](bitcoin#24462) includes changes that SegWit and Taproot-oriented that have been omitted from the backport. * In [bitcoin#22949](bitcoin#22949), `rpc_fundrawtransaction.py`'s `restart_node()` needs to be passed an empty set of `extra_args` to avoid the following test failure (see below) ``` $ python3 ./test/functional/rpc_fundrawtransaction.py --descriptors 2025-11-03T11:19:02.448000Z TestFramework (INFO): PRNG seed is: 4253671634984506297 2025-11-03T11:19:02.448000Z TestFramework (INFO): Initializing test directory /var/folders/gt/rf6wpfx963x__7wg283kwnxc0000gp/T/dash_func_test_gylr91av 2025-11-03T11:19:04.236000Z TestFramework (INFO): Connect nodes, set fees, generate blocks, and sync [...] 2025-11-03T11:19:24.065000Z TestFramework (INFO): Test issue 22670 ApproximateBestSubset bug 2025-11-03T11:20:02.261000Z TestFramework (ERROR): Unexpected exception caught during testing Traceback (most recent call last): File "/src/dash/test/functional/test_framework/test_framework.py", line 163, in main self.run_test() File "/src/dash/./test/functional/rpc_fundrawtransaction.py", line 134, in run_test self.test_22670() File "/src/dash/./test/functional/rpc_fundrawtransaction.py", line 1084, in test_22670 self.restart_node(0) File "/src/dash/test/functional/test_framework/test_framework.py", line 697, in restart_node self.start_node(i, extra_args) File "/src/dash/test/functional/test_framework/test_framework.py", line 655, in start_node node.wait_for_rpc_connection() File "/src/dash/test/functional/test_framework/test_node.py", line 271, in wait_for_rpc_connection raise FailedToStartError(self._node_msg( test_framework.test_node.FailedToStartError: [node 0] dashd exited with status 1 during initialization. Error: Error loading default_wallet: You can't disable HD on an already existing HD wallet ************************ ``` * ~~To deal with frequent functional test failures due to `rpc_mempool_entry_fee_fields_deprecation.py` experiencing port conflicts ([build](https://github.com/dashpay/dash/actions/runs/19031966785/job/54350070090#step:6:1117), [build](https://github.com/dashpay/dash/actions/runs/19031966785/job/54350107927#step:6:1128)) retries will modify the port seed to try again with a different set of likely non-conflicting ports.~~ Superseded by [dash#6937](#6937). ## Breaking Changes Building with UPnP enabled requires miniupnpc API version 17 (raising the minimum version from v1.9 to v2.1). ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)** - [x] I have added or updated relevant unit/integration/functional/e2e tests - [x] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK 2eef89c Tree-SHA512: 8814ff6b01ac096107d0a78c89806ea1902653c0444db84c476698af4ff5cf1c7fc42b09fce4c3c62f16adce26f1e10cec15ca4c96078c58cdcce7b640a5163d
2 parents eea343b + 2eef89c commit e8c71ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+549
-284
lines changed

ci/dash/lint-tidy.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ iwyu_tool.py \
2424
"src/dbwrapper.cpp" \
2525
"src/init" \
2626
"src/node/chainstate.cpp" \
27+
"src/node/minisketchwrapper.cpp" \
2728
"src/policy/feerate.cpp" \
2829
"src/policy/packages.cpp" \
2930
"src/policy/settings.cpp" \
3031
"src/primitives/transaction.cpp" \
32+
"src/random.cpp" \
3133
"src/rpc/fees.cpp" \
3234
"src/rpc/signmessage.cpp" \
3335
"src/test/fuzz/txorphan.cpp" \

configure.ac

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,6 +1503,12 @@ if test "$use_usdt" != "no"; then
15031503
fi
15041504
AM_CONDITIONAL([ENABLE_USDT_TRACEPOINTS], [test "$use_usdt" = "yes"])
15051505

1506+
if test "$build_bitcoind$bitcoin_enable_qt$use_bench$use_tests" = "nononono"; then
1507+
use_upnp=no
1508+
use_natpmp=no
1509+
use_zmq=no
1510+
fi
1511+
15061512
dnl Check for libminiupnpc (optional)
15071513
if test "$use_upnp" != "no"; then
15081514
TEMP_CPPFLAGS="$CPPFLAGS"
@@ -1512,14 +1518,15 @@ if test "$use_upnp" != "no"; then
15121518
[AC_CHECK_LIB([miniupnpc], [upnpDiscover], [MINIUPNPC_LIBS="$MINIUPNPC_LIBS -lminiupnpc"], [have_miniupnpc=no], [$MINIUPNPC_LIBS])],
15131519
[have_miniupnpc=no]
15141520
)
1515-
dnl The minimum supported miniUPnPc API version is set to 10. This keeps compatibility
1516-
dnl with Ubuntu 16.04 LTS and Debian 8 libminiupnpc-dev packages.
1521+
1522+
dnl The minimum supported miniUPnPc API version is set to 17. This excludes
1523+
dnl versions with known vulnerabilities.
15171524
if test "$have_miniupnpc" != "no"; then
15181525
AC_MSG_CHECKING([whether miniUPnPc API version is supported])
15191526
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
15201527
@%:@include <miniupnpc/miniupnpc.h>
15211528
]], [[
1522-
#if MINIUPNPC_API_VERSION >= 10
1529+
#if MINIUPNPC_API_VERSION >= 17
15231530
// Everything is okay
15241531
#else
15251532
# error miniUPnPc API version is too old
@@ -1528,7 +1535,7 @@ if test "$use_upnp" != "no"; then
15281535
AC_MSG_RESULT([yes])
15291536
],[
15301537
AC_MSG_RESULT([no])
1531-
AC_MSG_WARN([miniUPnPc API version < 10 is unsupported, disabling UPnP support.])
1538+
AC_MSG_WARN([miniUPnPc API version < 17 is unsupported, disabling UPnP support.])
15321539
have_miniupnpc=no
15331540
])
15341541
fi

doc/dependencies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ You can find installation instructions in the `build-*.md` file for your platfor
3939
| Dependency | Releases | Version used | Minimum required | Runtime |
4040
| --- | --- | --- | --- | --- |
4141
| [libnatpmp](../depends/packages/libnatpmp.mk) | [link](https://github.com/miniupnp/libnatpmp/) | commit [07004b9...](https://github.com/miniupnp/libnatpmp/tree/07004b97cf691774efebe70404cf22201e4d330d) | | No |
42-
| [MiniUPnPc](../depends/packages/miniupnpc.mk) | [link](https://miniupnp.tuxfamily.org/) | [2.2.2](https://github.com/bitcoin/bitcoin/pull/20421) | 1.9 | No |
42+
| [MiniUPnPc](../depends/packages/miniupnpc.mk) | [link](https://miniupnp.tuxfamily.org/) | [2.2.2](https://github.com/bitcoin/bitcoin/pull/20421) | 2.1 | No |
4343

4444
### Notifications
4545
| Dependency | Releases | Version used | Minimum required | Runtime |

doc/release-notes-6901.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Notable changes
2+
===============
3+
4+
New settings
5+
------------
6+
7+
- The `shutdownnotify` option is used to specify a command to execute synchronously
8+
before Dash Core has begun its shutdown sequence.

src/Makefile.am

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ BITCOIN_CORE_H = \
259259
instantsend/instantsend.h \
260260
instantsend/lock.h \
261261
instantsend/signing.h \
262+
kernel/coinstats.h \
262263
key.h \
263264
key_io.h \
264265
limitedmap.h \
@@ -306,7 +307,6 @@ BITCOIN_CORE_H = \
306307
node/caches.h \
307308
node/chainstate.h \
308309
node/coin.h \
309-
node/coinstats.h \
310310
node/connection_types.h \
311311
node/context.h \
312312
node/eviction.h \
@@ -530,6 +530,7 @@ libbitcoin_node_a_SOURCES = \
530530
instantsend/instantsend.cpp \
531531
instantsend/lock.cpp \
532532
instantsend/signing.cpp \
533+
kernel/coinstats.cpp \
533534
llmq/blockprocessor.cpp \
534535
llmq/commitment.cpp \
535536
llmq/context.cpp \
@@ -561,7 +562,6 @@ libbitcoin_node_a_SOURCES = \
561562
node/caches.cpp \
562563
node/chainstate.cpp \
563564
node/coin.cpp \
564-
node/coinstats.cpp \
565565
node/connection_types.cpp \
566566
node/context.cpp \
567567
node/eviction.cpp \
@@ -1087,7 +1087,21 @@ dash_wallet_SOURCES = bitcoin-wallet.cpp
10871087
dash_wallet_CPPFLAGS = $(bitcoin_bin_cppflags)
10881088
dash_wallet_CXXFLAGS = $(bitcoin_bin_cxxflags)
10891089
dash_wallet_LDFLAGS = $(bitcoin_bin_ldflags)
1090-
dash_wallet_LDADD = $(LIBBITCOIN_WALLET_TOOL) $(bitcoin_bin_ldadd)
1090+
dash_wallet_LDADD = \
1091+
$(LIBBITCOIN_WALLET_TOOL) \
1092+
$(LIBBITCOIN_WALLET) \
1093+
$(LIBBITCOIN_COMMON) \
1094+
$(LIBBITCOIN_UTIL) \
1095+
$(LIBUNIVALUE) \
1096+
$(LIBBITCOIN_CONSENSUS) \
1097+
$(LIBBITCOIN_CRYPTO) \
1098+
$(LIBDASHBLS) \
1099+
$(LIBSECP256K1) \
1100+
$(BACKTRACE_LIB) \
1101+
$(BOOST_LIBS) \
1102+
$(BDB_LIBS) \
1103+
$(SQLITE_LIBS) \
1104+
$(GMP_LIBS)
10911105

10921106
if TARGET_WINDOWS
10931107
dash_wallet_SOURCES += dash-wallet-res.rc

src/index/coinstatsindex.cpp

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
#include <validation.h>
1515
#include <util/check.h>
1616

17-
using node::CCoinsStats;
18-
using node::GetBogoSize;
17+
using kernel::CCoinsStats;
18+
using kernel::GetBogoSize;
19+
using kernel::TxOutSer;
20+
1921
using node::ReadBlockFromDisk;
20-
using node::TxOutSer;
2122
using node::UndoReadFromDisk;
2223

2324
static constexpr uint8_t DB_BLOCK_HASH{'s'};
@@ -316,28 +317,31 @@ static bool LookUpOne(const CDBWrapper& db, const CBlockIndex* block_index, DBVa
316317
return db.Read(DBHashKey(block_index->GetBlockHash()), result);
317318
}
318319

319-
bool CoinStatsIndex::LookUpStats(const CBlockIndex* block_index, CCoinsStats& coins_stats) const
320+
std::optional<CCoinsStats> CoinStatsIndex::LookUpStats(const CBlockIndex* block_index) const
320321
{
322+
CCoinsStats stats{Assert(block_index)->nHeight, block_index->GetBlockHash()};
323+
stats.index_used = true;
324+
321325
DBVal entry;
322326
if (!LookUpOne(*m_db, block_index, entry)) {
323-
return false;
327+
return std::nullopt;
324328
}
325329

326-
coins_stats.hashSerialized = entry.muhash;
327-
coins_stats.nTransactionOutputs = entry.transaction_output_count;
328-
coins_stats.nBogoSize = entry.bogo_size;
329-
coins_stats.total_amount = entry.total_amount;
330-
coins_stats.total_subsidy = entry.total_subsidy;
331-
coins_stats.total_unspendable_amount = entry.total_unspendable_amount;
332-
coins_stats.total_prevout_spent_amount = entry.total_prevout_spent_amount;
333-
coins_stats.total_new_outputs_ex_coinbase_amount = entry.total_new_outputs_ex_coinbase_amount;
334-
coins_stats.total_coinbase_amount = entry.total_coinbase_amount;
335-
coins_stats.total_unspendables_genesis_block = entry.total_unspendables_genesis_block;
336-
coins_stats.total_unspendables_bip30 = entry.total_unspendables_bip30;
337-
coins_stats.total_unspendables_scripts = entry.total_unspendables_scripts;
338-
coins_stats.total_unspendables_unclaimed_rewards = entry.total_unspendables_unclaimed_rewards;
339-
340-
return true;
330+
stats.hashSerialized = entry.muhash;
331+
stats.nTransactionOutputs = entry.transaction_output_count;
332+
stats.nBogoSize = entry.bogo_size;
333+
stats.total_amount = entry.total_amount;
334+
stats.total_subsidy = entry.total_subsidy;
335+
stats.total_unspendable_amount = entry.total_unspendable_amount;
336+
stats.total_prevout_spent_amount = entry.total_prevout_spent_amount;
337+
stats.total_new_outputs_ex_coinbase_amount = entry.total_new_outputs_ex_coinbase_amount;
338+
stats.total_coinbase_amount = entry.total_coinbase_amount;
339+
stats.total_unspendables_genesis_block = entry.total_unspendables_genesis_block;
340+
stats.total_unspendables_bip30 = entry.total_unspendables_bip30;
341+
stats.total_unspendables_scripts = entry.total_unspendables_scripts;
342+
stats.total_unspendables_unclaimed_rewards = entry.total_unspendables_unclaimed_rewards;
343+
344+
return stats;
341345
}
342346

343347
bool CoinStatsIndex::Init()

src/index/coinstatsindex.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <crypto/muhash.h>
1010
#include <flatfile.h>
1111
#include <index/base.h>
12-
#include <node/coinstats.h>
12+
#include <kernel/coinstats.h>
1313

1414
/**
1515
* CoinStatsIndex maintains statistics on the UTXO set.
@@ -56,7 +56,7 @@ class CoinStatsIndex final : public BaseIndex
5656
explicit CoinStatsIndex(size_t n_cache_size, bool f_memory = false, bool f_wipe = false);
5757

5858
// Look up stats for a specific block using CBlockIndex
59-
bool LookUpStats(const CBlockIndex* block_index, node::CCoinsStats& coins_stats) const;
59+
std::optional<kernel::CCoinsStats> LookUpStats(const CBlockIndex* block_index) const;
6060
};
6161

6262
/// The global UTXO set hash object.

src/init.cpp

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <context.h>
2020
#include <consensus/amount.h>
2121
#include <deploymentstatus.h>
22-
#include <node/coinstats.h>
2322
#include <fs.h>
2423
#include <hash.h>
2524
#include <httpserver.h>
@@ -32,6 +31,7 @@
3231
#include <interfaces/init.h>
3332
#include <interfaces/node.h>
3433
#include <interfaces/wallet.h>
34+
#include <kernel/coinstats.h>
3535
#include <mapport.h>
3636
#include <node/miner.h>
3737
#include <net.h>
@@ -134,10 +134,10 @@
134134
#include <zmq/zmqrpc.h>
135135
#endif
136136

137+
using kernel::CoinStatsHashType;
138+
137139
using node::CacheSizes;
138140
using node::CalculateCacheSizes;
139-
using node::CCoinsStats;
140-
using node::CoinStatsHashType;
141141
using node::ChainstateLoadingError;
142142
using node::ChainstateLoadVerifyError;
143143
using node::DashChainstateSetupClose;
@@ -224,8 +224,24 @@ static fs::path GetPidFile(const ArgsManager& args)
224224
// shutdown thing.
225225
//
226226

227+
#if HAVE_SYSTEM
228+
static void ShutdownNotify(const ArgsManager& args)
229+
{
230+
std::vector<std::thread> threads;
231+
for (const auto& cmd : args.GetArgs("-shutdownnotify")) {
232+
threads.emplace_back(runCommand, cmd);
233+
}
234+
for (auto& t : threads) {
235+
t.join();
236+
}
237+
}
238+
#endif
239+
227240
void Interrupt(NodeContext& node)
228241
{
242+
#if HAVE_SYSTEM
243+
ShutdownNotify(*node.args);
244+
#endif
229245
InterruptHTTPServer();
230246
InterruptHTTPRPC();
231247
InterruptRPC();
@@ -439,7 +455,6 @@ void Shutdown(NodeContext& node)
439455
LogPrintf("%s: Unable to remove PID file: %s\n", __func__, fsbridge::get_filesystem_error_message(e));
440456
}
441457

442-
node.args = nullptr;
443458
LogPrintf("%s: done\n", __func__);
444459
}
445460

@@ -553,6 +568,7 @@ void SetupServerArgs(ArgsManager& argsman)
553568
argsman.AddArg("-syncmempool", strprintf("Sync mempool from other nodes on start (default: %u)", DEFAULT_SYNC_MEMPOOL), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
554569
#if HAVE_SYSTEM
555570
argsman.AddArg("-startupnotify=<cmd>", "Execute command on startup.", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
571+
argsman.AddArg("-shutdownnotify=<cmd>", "Execute command immediately before beginning shutdown. The need for shutdown may be urgent, so be careful not to delay it long (if the command doesn't require interaction with the server, consider having it fork into the background).", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
556572
#endif
557573
#ifndef WIN32
558574
argsman.AddArg("-sysperms", "Create new files with system default permissions, instead of umask 077 (only effective with disabled wallet functionality)", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
@@ -840,15 +856,15 @@ static void PeriodicStats(NodeContext& node)
840856
ChainstateManager& chainman = *Assert(node.chainman);
841857
const CTxMemPool& mempool = *Assert(node.mempool);
842858
const llmq::CInstantSendManager& isman = *Assert(node.llmq_ctx->isman);
843-
CCoinsStats stats{CoinStatsHashType::NONE};
844859
chainman.ActiveChainstate().ForceFlushStateToDisk();
845-
if (WITH_LOCK(cs_main, return GetUTXOStats(&chainman.ActiveChainstate().CoinsDB(), chainman.m_blockman, stats, node.rpc_interruption_point, chainman.ActiveChain().Tip()))) {
846-
::g_stats_client->gauge("utxoset.tx", stats.nTransactions, 1.0f);
847-
::g_stats_client->gauge("utxoset.txOutputs", stats.nTransactionOutputs, 1.0f);
848-
::g_stats_client->gauge("utxoset.dbSizeBytes", stats.nDiskSize, 1.0f);
849-
::g_stats_client->gauge("utxoset.blockHeight", stats.nHeight, 1.0f);
850-
if (stats.total_amount.has_value()) {
851-
::g_stats_client->gauge("utxoset.totalAmount", (double)stats.total_amount.value() / (double)COIN, 1.0f);
860+
const auto maybe_stats = WITH_LOCK(::cs_main, return GetUTXOStats(&chainman.ActiveChainstate().CoinsDB(), chainman.m_blockman, /*hash_type=*/CoinStatsHashType::NONE, node.rpc_interruption_point, chainman.ActiveChain().Tip(), /*index_requested=*/true));
861+
if (maybe_stats.has_value()) {
862+
::g_stats_client->gauge("utxoset.tx", maybe_stats->nTransactions, 1.0f);
863+
::g_stats_client->gauge("utxoset.txOutputs", maybe_stats->nTransactionOutputs, 1.0f);
864+
::g_stats_client->gauge("utxoset.dbSizeBytes", maybe_stats->nDiskSize, 1.0f);
865+
::g_stats_client->gauge("utxoset.blockHeight", maybe_stats->nHeight, 1.0f);
866+
if (maybe_stats->total_amount.has_value()) {
867+
::g_stats_client->gauge("utxoset.totalAmount", (double)maybe_stats->total_amount.value() / (double)COIN, 1.0f);
852868
}
853869
} else {
854870
// something went wrong
@@ -2306,6 +2322,24 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
23062322
return false;
23072323
}
23082324

2325+
int chain_active_height = WITH_LOCK(cs_main, return chainman.ActiveChain().Height());
2326+
2327+
// On first startup, warn on low block storage space
2328+
if (!fReindex && !fReindexChainState && chain_active_height <= 1) {
2329+
uint64_t additional_bytes_needed = fPruneMode ? nPruneTarget
2330+
: chainparams.AssumedBlockchainSize() * 1024 * 1024 * 1024;
2331+
2332+
if (!CheckDiskSpace(args.GetBlocksDirPath(), additional_bytes_needed)) {
2333+
InitWarning(strprintf(_(
2334+
"Disk space for %s may not accommodate the block files. " \
2335+
"Approximately %u GB of data will be stored in this directory."
2336+
),
2337+
fs::quoted(fs::PathToString(args.GetBlocksDirPath())),
2338+
chainparams.AssumedBlockchainSize()
2339+
));
2340+
}
2341+
}
2342+
23092343
// Either install a handler to notify us when genesis activates, or set fHaveGenesis directly.
23102344
// No locking, as this happens before any background thread is started.
23112345
boost::signals2::connection block_notify_genesis_wait_connection;
@@ -2396,8 +2430,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
23962430

23972431
// ********************************************************* Step 12: start node
23982432

2399-
int chain_active_height;
2400-
24012433
//// debug print
24022434
{
24032435
LOCK(cs_main);

src/interfaces/node.h

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
#ifndef BITCOIN_INTERFACES_NODE_H
66
#define BITCOIN_INTERFACES_NODE_H
77

8-
#include <consensus/amount.h> // For CAmount
9-
#include <net.h> // For NodeId
10-
#include <net_types.h> // For banmap_t
11-
#include <netaddress.h> // For Network
12-
#include <netbase.h> // For ConnectionDirection
8+
#include <consensus/amount.h> // For CAmount
9+
#include <net.h> // For NodeId
10+
#include <net_types.h> // For banmap_t
11+
#include <netaddress.h> // For Network
12+
#include <netbase.h> // For ConnectionDirection
1313
#include <support/allocators/secure.h> // For SecureString
1414
#include <uint256.h>
15+
#include <util/settings.h> // For util::SettingsValue
1516
#include <util/translation.h>
1617

1718
#include <functional>
@@ -193,6 +194,24 @@ class Node
193194
//! Return whether shutdown was requested.
194195
virtual bool shutdownRequested() = 0;
195196

197+
//! Return whether a particular setting in <datadir>/settings.json is or
198+
//! would be ignored because it is also specified in the command line.
199+
virtual bool isSettingIgnored(const std::string& name) = 0;
200+
201+
//! Return setting value from <datadir>/settings.json or dash.conf.
202+
virtual util::SettingsValue getPersistentSetting(const std::string& name) = 0;
203+
204+
//! Update a setting in <datadir>/settings.json.
205+
virtual void updateRwSetting(const std::string& name, const util::SettingsValue& value) = 0;
206+
207+
//! Force a setting value to be applied, overriding any other configuration
208+
//! source, but not being persisted.
209+
virtual void forceSetting(const std::string& name, const util::SettingsValue& value) = 0;
210+
211+
//! Clear all settings in <datadir>/settings.json and store a backup of
212+
//! previous settings in <datadir>/settings.json.bak.
213+
virtual void resetSettings() = 0;
214+
196215
//! Map port.
197216
virtual void mapPort(bool use_upnp, bool use_natpmp) = 0;
198217

0 commit comments

Comments
 (0)