mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
Merge 624333455a into merged_master (Bitcoin PR bitcoin/bitcoin#26296)
This commit is contained in:
commit
81083d47bf
23 changed files with 294 additions and 66 deletions
|
|
@ -1,5 +1,6 @@
|
|||
Checks: '
|
||||
-*,
|
||||
bitcoin-unterminated-logprintf,
|
||||
bugprone-argument-comment,
|
||||
bugprone-use-after-move,
|
||||
misc-unused-using-decls,
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ public:
|
|||
|
||||
assert(p <= limit);
|
||||
base[std::min(bufsize - 1, (int)(p - base))] = '\0';
|
||||
LogPrintLevel(BCLog::LEVELDB, BCLog::Level::Debug, "%s", base); /* Continued */
|
||||
LogPrintLevel(BCLog::LEVELDB, BCLog::Level::Debug, "%s", base); // NOLINT(bitcoin-unterminated-logprintf)
|
||||
if (base != buffer) {
|
||||
delete[] base;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ void BaseIndex::BlockConnected(const std::shared_ptr<const CBlock>& block, const
|
|||
// in the ValidationInterface queue backlog even after the sync thread has caught up to the
|
||||
// new chain tip. In this unlikely event, log a warning and let the queue clear.
|
||||
if (best_block_index->GetAncestor(pindex->nHeight - 1) != pindex->pprev) {
|
||||
LogPrintf("%s: WARNING: Block %s does not connect to an ancestor of " /* Continued */
|
||||
LogPrintf("%s: WARNING: Block %s does not connect to an ancestor of "
|
||||
"known best chain (tip=%s); not updating index\n",
|
||||
__func__, pindex->GetBlockHash().ToString(),
|
||||
best_block_index->GetBlockHash().ToString());
|
||||
|
|
@ -322,7 +322,7 @@ void BaseIndex::ChainStateFlushed(const CBlockLocator& locator)
|
|||
// event, log a warning and let the queue clear.
|
||||
const CBlockIndex* best_block_index = m_best_block_index.load();
|
||||
if (best_block_index->GetAncestor(locator_tip_index->nHeight) != locator_tip_index) {
|
||||
LogPrintf("%s: WARNING: Locator contains block (hash=%s) not on known best " /* Continued */
|
||||
LogPrintf("%s: WARNING: Locator contains block (hash=%s) not on known best "
|
||||
"chain (tip=%s); not writing index locator\n",
|
||||
__func__, locator_tip_hash.ToString(),
|
||||
best_block_index->GetBlockHash().ToString());
|
||||
|
|
|
|||
|
|
@ -1214,7 +1214,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
|
||||
// Warn about relative -datadir path.
|
||||
if (args.IsArgSet("-datadir") && !args.GetPathArg("-datadir").is_absolute()) {
|
||||
LogPrintf("Warning: relative datadir option '%s' specified, which will be interpreted relative to the " /* Continued */
|
||||
LogPrintf("Warning: relative datadir option '%s' specified, which will be interpreted relative to the "
|
||||
"current working directory '%s'. This is fragile, because if bitcoin is started in the future "
|
||||
"from a different location, it will be unable to locate the current data files. There could "
|
||||
"also be data loss if bitcoin is started while in a temporary directory.\n",
|
||||
|
|
|
|||
|
|
@ -3100,7 +3100,7 @@ bool PeerManagerImpl::PrepareBlockFilterRequest(CNode& node, Peer& peer,
|
|||
|
||||
uint32_t stop_height = stop_index->nHeight;
|
||||
if (start_height > stop_height) {
|
||||
LogPrint(BCLog::NET, "peer %d sent invalid getcfilters/getcfheaders with " /* Continued */
|
||||
LogPrint(BCLog::NET, "peer %d sent invalid getcfilters/getcfheaders with "
|
||||
"start height %d and stop height %d\n",
|
||||
node.GetId(), start_height, stop_height);
|
||||
node.fDisconnect = true;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ bool WriteSnapshotBaseBlockhash(Chainstate& snapshot_chainstate)
|
|||
std::optional<uint256> ReadSnapshotBaseBlockhash(fs::path chaindir)
|
||||
{
|
||||
if (!fs::exists(chaindir)) {
|
||||
LogPrintf("[snapshot] cannot read base blockhash: no chainstate dir " /* Continued */
|
||||
LogPrintf("[snapshot] cannot read base blockhash: no chainstate dir "
|
||||
"exists at path %s\n", fs::PathToString(chaindir));
|
||||
return std::nullopt;
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ std::optional<uint256> ReadSnapshotBaseBlockhash(fs::path chaindir)
|
|||
const std::string read_from_str = fs::PathToString(read_from);
|
||||
|
||||
if (!fs::exists(read_from)) {
|
||||
LogPrintf("[snapshot] snapshot chainstate dir is malformed! no base blockhash file " /* Continued */
|
||||
LogPrintf("[snapshot] snapshot chainstate dir is malformed! no base blockhash file "
|
||||
"exists at path %s. Try deleting %s and calling loadtxoutset again?\n",
|
||||
fs::PathToString(chaindir), read_from_str);
|
||||
return std::nullopt;
|
||||
|
|
|
|||
|
|
@ -83,10 +83,10 @@ BOOST_AUTO_TEST_CASE(logging_timer)
|
|||
BOOST_FIXTURE_TEST_CASE(logging_LogPrintf_, LogSetup)
|
||||
{
|
||||
LogInstance().m_log_sourcelocations = true;
|
||||
LogPrintf_("fn1", "src1", 1, BCLog::LogFlags::NET, BCLog::Level::Debug, "foo1: %s", "bar1\n");
|
||||
LogPrintf_("fn2", "src2", 2, BCLog::LogFlags::NET, BCLog::Level::None, "foo2: %s", "bar2\n");
|
||||
LogPrintf_("fn3", "src3", 3, BCLog::LogFlags::NONE, BCLog::Level::Debug, "foo3: %s", "bar3\n");
|
||||
LogPrintf_("fn4", "src4", 4, BCLog::LogFlags::NONE, BCLog::Level::None, "foo4: %s", "bar4\n");
|
||||
LogPrintf_("fn1", "src1", 1, BCLog::LogFlags::NET, BCLog::Level::Debug, "foo1: %s\n", "bar1");
|
||||
LogPrintf_("fn2", "src2", 2, BCLog::LogFlags::NET, BCLog::Level::None, "foo2: %s\n", "bar2");
|
||||
LogPrintf_("fn3", "src3", 3, BCLog::LogFlags::NONE, BCLog::Level::Debug, "foo3: %s\n", "bar3");
|
||||
LogPrintf_("fn4", "src4", 4, BCLog::LogFlags::NONE, BCLog::Level::None, "foo4: %s\n", "bar4");
|
||||
std::ifstream file{tmp_log_path};
|
||||
std::vector<std::string> log_lines;
|
||||
for (std::string log; std::getline(file, log);) {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ CreateAndActivateUTXOSnapshot(
|
|||
UniValue result = CreateUTXOSnapshot(
|
||||
node, node.chainman->ActiveChainstate(), auto_outfile, snapshot_path, snapshot_path);
|
||||
LogPrintf(
|
||||
"Wrote UTXO snapshot to %s: %s", fs::PathToString(snapshot_path.make_preferred()), result.write());
|
||||
"Wrote UTXO snapshot to %s: %s\n", fs::PathToString(snapshot_path.make_preferred()), result.write());
|
||||
|
||||
// Read the written snapshot in and then activate it.
|
||||
//
|
||||
|
|
|
|||
|
|
@ -3428,7 +3428,7 @@ bool Chainstate::ActivateBestChain(BlockValidationState& state, std::shared_ptr<
|
|||
// Belt-and-suspenders check that we aren't attempting to advance the background
|
||||
// chainstate past the snapshot base block.
|
||||
if (WITH_LOCK(::cs_main, return m_disabled)) {
|
||||
LogPrintf("m_disabled is set - this chainstate should not be in operation. " /* Continued */
|
||||
LogPrintf("m_disabled is set - this chainstate should not be in operation. "
|
||||
"Please report this as a bug. %s\n", PACKAGE_BUGREPORT);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -5701,7 +5701,7 @@ bool ChainstateManager::PopulateAndValidateSnapshot(
|
|||
auto maybe_au_data = ExpectedAssumeutxo(base_height, GetParams());
|
||||
|
||||
if (!maybe_au_data) {
|
||||
LogPrintf("[snapshot] assumeutxo height in snapshot metadata not recognized " /* Continued */
|
||||
LogPrintf("[snapshot] assumeutxo height in snapshot metadata not recognized "
|
||||
"(%d) - refusing to load snapshot\n", base_height);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -5948,8 +5948,8 @@ SnapshotCompletionResult ChainstateManager::MaybeCompleteSnapshotValidation()
|
|||
};
|
||||
|
||||
if (index_new.GetBlockHash() != snapshot_blockhash) {
|
||||
LogPrintf("[snapshot] supposed base block %s does not match the " /* Continued */
|
||||
"snapshot base block %s (height %d). Snapshot is not valid.",
|
||||
LogPrintf("[snapshot] supposed base block %s does not match the "
|
||||
"snapshot base block %s (height %d). Snapshot is not valid.\n",
|
||||
index_new.ToString(), snapshot_blockhash.ToString(), snapshot_base_height);
|
||||
handle_invalid_snapshot();
|
||||
return SnapshotCompletionResult::BASE_BLOCKHASH_MISMATCH;
|
||||
|
|
@ -5969,7 +5969,7 @@ SnapshotCompletionResult ChainstateManager::MaybeCompleteSnapshotValidation()
|
|||
|
||||
auto maybe_au_data = ExpectedAssumeutxo(curr_height, m_options.chainparams);
|
||||
if (!maybe_au_data) {
|
||||
LogPrintf("[snapshot] assumeutxo data not found for height " /* Continued */
|
||||
LogPrintf("[snapshot] assumeutxo data not found for height "
|
||||
"(%d) - refusing to validate snapshot\n", curr_height);
|
||||
handle_invalid_snapshot();
|
||||
return SnapshotCompletionResult::MISSING_CHAINPARAMS;
|
||||
|
|
@ -5977,7 +5977,7 @@ SnapshotCompletionResult ChainstateManager::MaybeCompleteSnapshotValidation()
|
|||
|
||||
const AssumeutxoData& au_data = *maybe_au_data;
|
||||
std::optional<CCoinsStats> maybe_ibd_stats;
|
||||
LogPrintf("[snapshot] computing UTXO stats for background chainstate to validate " /* Continued */
|
||||
LogPrintf("[snapshot] computing UTXO stats for background chainstate to validate "
|
||||
"snapshot - this could take a few minutes\n");
|
||||
try {
|
||||
maybe_ibd_stats = ComputeUTXOStats(
|
||||
|
|
@ -6215,7 +6215,7 @@ bool ChainstateManager::ValidatedSnapshotCleanup()
|
|||
// is in-memory, in which case we can't do on-disk cleanup. You'd better be
|
||||
// in a unittest!
|
||||
if (!ibd_chainstate_path_maybe || !snapshot_chainstate_path_maybe) {
|
||||
LogPrintf("[snapshot] snapshot chainstate cleanup cannot happen with " /* Continued */
|
||||
LogPrintf("[snapshot] snapshot chainstate cleanup cannot happen with "
|
||||
"in-memory chainstates. You are testing, right?\n");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -6258,7 +6258,7 @@ bool ChainstateManager::ValidatedSnapshotCleanup()
|
|||
throw;
|
||||
}
|
||||
|
||||
LogPrintf("[snapshot] moving snapshot chainstate (%s) to " /* Continued */
|
||||
LogPrintf("[snapshot] moving snapshot chainstate (%s) to "
|
||||
"default chainstate directory (%s)\n",
|
||||
fs::PathToString(snapshot_chainstate_path), fs::PathToString(ibd_chainstate_path));
|
||||
|
||||
|
|
@ -6272,7 +6272,7 @@ bool ChainstateManager::ValidatedSnapshotCleanup()
|
|||
if (!DeleteCoinsDBFromDisk(tmp_old, /*is_snapshot=*/false)) {
|
||||
// No need to FatalError because once the unneeded bg chainstate data is
|
||||
// moved, it will not interfere with subsequent initialization.
|
||||
LogPrintf("Deletion of %s failed. Please remove it manually, as the " /* Continued */
|
||||
LogPrintf("Deletion of %s failed. Please remove it manually, as the "
|
||||
"directory is now unnecessary.\n",
|
||||
fs::PathToString(tmp_old));
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -2601,7 +2601,7 @@ OutputType CWallet::TransactionChangeType(const std::optional<OutputType>& chang
|
|||
void CWallet::CommitTransaction(CTransactionRef tx, mapValue_t mapValue, std::vector<std::pair<std::string, std::string>> orderForm, const BlindDetails* blind_details)
|
||||
{
|
||||
LOCK(cs_wallet);
|
||||
WalletLogPrintf("CommitTransaction:\n%s", tx->ToString()); /* Continued */
|
||||
WalletLogPrintf("CommitTransaction:\n%s", tx->ToString());
|
||||
|
||||
// Add tx to wallet, because if it has change it's also ours,
|
||||
// otherwise just for transaction history.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue