forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
backport: merge bitcoin#23345, #24410, #15936, #25748, #25863, #24051, #25315, #26624, #26894, #26673, #24462, #25815, #22949, #26723, #23395, #27016, #27189, #27317 (auxiliary backports: part 28) #6901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
43e2a19
merge bitcoin#23345: Drop unneeded dependencies for bitcoin-wallet tool
kwvg bdf5e92
merge bitcoin#24410: Split hashing/index `GetUTXOStats` codepaths, de…
kwvg 5d69d18
merge bitcoin#15936: Expose settings.json methods to GUI
kwvg 65299a0
merge bitcoin#25748: Avoid copies in FlatSigningProvider Merge
kwvg 55a474f
merge bitcoin#25863: remove unused norm_prv parameter in `descriptor_…
kwvg adeebb0
merge bitcoin#24051: bitcoin-{cli,tx,util} don't need UPnP, NAT-PMP, …
kwvg 3a58533
merge bitcoin#25315: Add warning on first startup if free disk space …
kwvg 2b3f925
merge bitcoin#26624: Rename local variable to distinguish it from typ…
kwvg 37ca4b4
merge bitcoin#26894: Remove redundant key_to_p2pkh call
kwvg 033e060
merge bitcoin#26673: Remove confusing getBool method
kwvg 945798c
merge bitcoin#24462: For descriptor pubkey parse errors, include cont…
kwvg 05fb900
merge bitcoin#25815: Use existing {Chainstate,Block}Man
kwvg b91c5b9
merge bitcoin#22949: Round up fee calculation to avoid a lower than e…
kwvg af0e14d
merge bitcoin#26723: call `keypoolrefill` with priv key disabled shou…
kwvg 51a9f24
merge bitcoin#23395: Add -shutdownnotify option
kwvg 5bed6ea
merge bitcoin#27016: require miniupnpc API version 17 or later
kwvg de6c0ae
merge bitcoin#27189: Use steady clock in SeedStrengthen, FindBestImpl…
kwvg 2eef89c
merge bitcoin#27317: Check that the timestamp string is non-empty to …
kwvg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| Notable changes | ||
| =============== | ||
|
|
||
| New settings | ||
| ------------ | ||
|
|
||
| - The `shutdownnotify` option is used to specify a command to execute synchronously | ||
| before Dash Core has begun its shutdown sequence. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,6 @@ | |
| #include <context.h> | ||
| #include <consensus/amount.h> | ||
| #include <deploymentstatus.h> | ||
| #include <node/coinstats.h> | ||
| #include <fs.h> | ||
| #include <hash.h> | ||
| #include <httpserver.h> | ||
|
|
@@ -32,6 +31,7 @@ | |
| #include <interfaces/init.h> | ||
| #include <interfaces/node.h> | ||
| #include <interfaces/wallet.h> | ||
| #include <kernel/coinstats.h> | ||
| #include <mapport.h> | ||
| #include <node/miner.h> | ||
| #include <net.h> | ||
|
|
@@ -134,10 +134,10 @@ | |
| #include <zmq/zmqrpc.h> | ||
| #endif | ||
|
|
||
| using kernel::CoinStatsHashType; | ||
|
|
||
| using node::CacheSizes; | ||
| using node::CalculateCacheSizes; | ||
| using node::CCoinsStats; | ||
| using node::CoinStatsHashType; | ||
| using node::ChainstateLoadingError; | ||
| using node::ChainstateLoadVerifyError; | ||
| using node::DashChainstateSetupClose; | ||
|
|
@@ -224,8 +224,24 @@ static fs::path GetPidFile(const ArgsManager& args) | |
| // shutdown thing. | ||
| // | ||
|
|
||
| #if HAVE_SYSTEM | ||
| static void ShutdownNotify(const ArgsManager& args) | ||
| { | ||
| std::vector<std::thread> threads; | ||
| for (const auto& cmd : args.GetArgs("-shutdownnotify")) { | ||
| threads.emplace_back(runCommand, cmd); | ||
| } | ||
| for (auto& t : threads) { | ||
| t.join(); | ||
| } | ||
| } | ||
| #endif | ||
|
|
||
| void Interrupt(NodeContext& node) | ||
| { | ||
| #if HAVE_SYSTEM | ||
| ShutdownNotify(*node.args); | ||
| #endif | ||
| InterruptHTTPServer(); | ||
| InterruptHTTPRPC(); | ||
| InterruptRPC(); | ||
|
|
@@ -439,7 +455,6 @@ void Shutdown(NodeContext& node) | |
| LogPrintf("%s: Unable to remove PID file: %s\n", __func__, fsbridge::get_filesystem_error_message(e)); | ||
| } | ||
|
|
||
| node.args = nullptr; | ||
| LogPrintf("%s: done\n", __func__); | ||
| } | ||
|
|
||
|
|
@@ -553,6 +568,7 @@ void SetupServerArgs(ArgsManager& argsman) | |
| argsman.AddArg("-syncmempool", strprintf("Sync mempool from other nodes on start (default: %u)", DEFAULT_SYNC_MEMPOOL), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); | ||
| #if HAVE_SYSTEM | ||
| argsman.AddArg("-startupnotify=<cmd>", "Execute command on startup.", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); | ||
| 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); | ||
| #endif | ||
| #ifndef WIN32 | ||
| 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) | |
| ChainstateManager& chainman = *Assert(node.chainman); | ||
| const CTxMemPool& mempool = *Assert(node.mempool); | ||
| const llmq::CInstantSendManager& isman = *Assert(node.llmq_ctx->isman); | ||
| CCoinsStats stats{CoinStatsHashType::NONE}; | ||
| chainman.ActiveChainstate().ForceFlushStateToDisk(); | ||
| if (WITH_LOCK(cs_main, return GetUTXOStats(&chainman.ActiveChainstate().CoinsDB(), chainman.m_blockman, stats, node.rpc_interruption_point, chainman.ActiveChain().Tip()))) { | ||
| ::g_stats_client->gauge("utxoset.tx", stats.nTransactions, 1.0f); | ||
| ::g_stats_client->gauge("utxoset.txOutputs", stats.nTransactionOutputs, 1.0f); | ||
| ::g_stats_client->gauge("utxoset.dbSizeBytes", stats.nDiskSize, 1.0f); | ||
| ::g_stats_client->gauge("utxoset.blockHeight", stats.nHeight, 1.0f); | ||
| if (stats.total_amount.has_value()) { | ||
| ::g_stats_client->gauge("utxoset.totalAmount", (double)stats.total_amount.value() / (double)COIN, 1.0f); | ||
| 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)); | ||
| if (maybe_stats.has_value()) { | ||
| ::g_stats_client->gauge("utxoset.tx", maybe_stats->nTransactions, 1.0f); | ||
| ::g_stats_client->gauge("utxoset.txOutputs", maybe_stats->nTransactionOutputs, 1.0f); | ||
| ::g_stats_client->gauge("utxoset.dbSizeBytes", maybe_stats->nDiskSize, 1.0f); | ||
| ::g_stats_client->gauge("utxoset.blockHeight", maybe_stats->nHeight, 1.0f); | ||
| if (maybe_stats->total_amount.has_value()) { | ||
| ::g_stats_client->gauge("utxoset.totalAmount", (double)maybe_stats->total_amount.value() / (double)COIN, 1.0f); | ||
| } | ||
| } else { | ||
| // something went wrong | ||
|
|
@@ -2304,6 +2320,24 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) | |
| return false; | ||
| } | ||
|
|
||
| int chain_active_height = WITH_LOCK(cs_main, return chainman.ActiveChain().Height()); | ||
|
|
||
| // On first startup, warn on low block storage space | ||
| if (!fReindex && !fReindexChainState && chain_active_height <= 1) { | ||
| uint64_t additional_bytes_needed = fPruneMode ? nPruneTarget | ||
| : chainparams.AssumedBlockchainSize() * 1024 * 1024 * 1024; | ||
|
|
||
| if (!CheckDiskSpace(args.GetBlocksDirPath(), additional_bytes_needed)) { | ||
| InitWarning(strprintf(_( | ||
| "Disk space for %s may not accommodate the block files. " \ | ||
| "Approximately %u GB of data will be stored in this directory." | ||
| ), | ||
| fs::quoted(fs::PathToString(args.GetBlocksDirPath())), | ||
| chainparams.AssumedBlockchainSize() | ||
| )); | ||
| } | ||
| } | ||
|
Comment on lines
+2323
to
+2339
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix first‑startup disk‑space warning for -prune=1. For manual prune ( - // On first startup, warn on low block storage space
+ // On first startup, warn on low block storage space
if (!fReindex && !fReindexChainState && chain_active_height <= 1) {
- uint64_t additional_bytes_needed = fPruneMode ? nPruneTarget
- : chainparams.AssumedBlockchainSize() * 1024 * 1024 * 1024;
+ const uint64_t approx_chain_bytes =
+ static_cast<uint64_t>(chainparams.AssumedBlockchainSize()) * 1024 * 1024 * 1024;
+ uint64_t additional_bytes_needed =
+ fPruneMode ? std::min(nPruneTarget, approx_chain_bytes) : approx_chain_bytes;
- if (!CheckDiskSpace(args.GetBlocksDirPath(), additional_bytes_needed)) {
- InitWarning(strprintf(_(
- "Disk space for %s may not accommodate the block files. " \
- "Approximately %u GB of data will be stored in this directory."
- ),
- fs::quoted(fs::PathToString(args.GetBlocksDirPath())),
- chainparams.AssumedBlockchainSize()
- ));
- }
+ if (!CheckDiskSpace(args.GetBlocksDirPath(), additional_bytes_needed)) {
+ InitWarning(strprintf(_("Disk space for %s may not accommodate the block files. Approximately %u GB of data will be stored in this directory."),
+ fs::quoted(fs::PathToString(args.GetBlocksDirPath())),
+ chainparams.AssumedBlockchainSize()));
+ }
}🤖 Prompt for AI Agents |
||
|
|
||
| // Either install a handler to notify us when genesis activates, or set fHaveGenesis directly. | ||
| // No locking, as this happens before any background thread is started. | ||
| boost::signals2::connection block_notify_genesis_wait_connection; | ||
|
|
@@ -2394,8 +2428,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) | |
|
|
||
| // ********************************************************* Step 12: start node | ||
|
|
||
| int chain_active_height; | ||
|
|
||
| //// debug print | ||
| { | ||
| LOCK(cs_main); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.