Skip to content

Commit

Permalink
Lower the log level of some manifest warnings on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
ximinez committed Feb 28, 2025
1 parent c1c2b5b commit 6f1b953
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
6 changes: 5 additions & 1 deletion src/xrpld/app/misc/Manifest.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,10 @@ class ManifestCache
@param m Manifest to add
@param loading Indicate whether the manifest is being loaded from the
local database (at startup). Lowers the severity of some log
messages.
@return `ManifestDisposition::accepted` if successful, or
`stale` or `invalid` otherwise
Expand All @@ -353,7 +357,7 @@ class ManifestCache
May be called concurrently
*/
ManifestDisposition
applyManifest(Manifest m);
applyManifest(Manifest m, bool loading = false);

/** Populate manifest cache with manifests in database and config.
Expand Down
21 changes: 12 additions & 9 deletions src/xrpld/app/misc/detail/Manifest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ ManifestCache::revoked(PublicKey const& pk) const
}

ManifestDisposition
ManifestCache::applyManifest(Manifest m)
ManifestCache::applyManifest(Manifest m, bool loading)
{
// Check the manifest against the conditions that do not require a
// `unique_lock` (write lock) on the `mutex_`. Since the signature can be
Expand All @@ -388,8 +388,10 @@ ManifestCache::applyManifest(Manifest m)
// comment below), `checkSignature` only needs to be set to true on the
// first run.
auto prewriteCheck =
[this, &m](auto const& iter, bool checkSignature, auto const& lock)
-> std::optional<ManifestDisposition> {
[this, &m, &loading](
auto const& iter,
bool checkSignature,
auto const& lock) -> std::optional<ManifestDisposition> {
XRPL_ASSERT(
lock.owns_lock(),
"ripple::ManifestCache::applyManifest::prewriteCheck : locked");
Expand Down Expand Up @@ -427,17 +429,18 @@ ManifestCache::applyManifest(Manifest m)
// one.
bool const revoked = m.revoked();

if (auto stream = j_.warn(); stream && revoked)
if (auto stream = loading ? j_.info() : j_.warn(); stream && revoked)
logMftAct(stream, "Revoked", m.masterKey, m.sequence);

// Sanity check: the master key of this manifest should not be used as
// the ephemeral key of another manifest:
if (auto const x = signingToMasterKeys_.find(m.masterKey);
x != signingToMasterKeys_.end())
{
JLOG(j_.warn()) << to_string(m)
<< ": Master key already used as ephemeral key for "
<< toBase58(TokenType::NodePublic, x->second);
JLOG((loading ? j_.info() : j_.warn()))
<< to_string(m)
<< ": Master key already used as ephemeral key for "
<< toBase58(TokenType::NodePublic, x->second);

return ManifestDisposition::badMasterKey;
}
Expand All @@ -458,7 +461,7 @@ ManifestCache::applyManifest(Manifest m)
if (auto const x = signingToMasterKeys_.find(*m.signingKey);
x != signingToMasterKeys_.end())
{
JLOG(j_.warn())
JLOG((loading ? j_.info() : j_.warn()))
<< to_string(m)
<< ": Ephemeral key already used as ephemeral key for "
<< toBase58(TokenType::NodePublic, x->second);
Expand All @@ -468,7 +471,7 @@ ManifestCache::applyManifest(Manifest m)

if (auto const x = map_.find(*m.signingKey); x != map_.end())
{
JLOG(j_.warn())
JLOG((loading ? j_.info() : j_.warn()))
<< to_string(m) << ": Ephemeral key used as master key for "
<< to_string(x->second);

Expand Down
2 changes: 1 addition & 1 deletion src/xrpld/app/rdb/detail/Wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ getManifests(
continue;
}

mCache.applyManifest(std::move(*mo));
mCache.applyManifest(std::move(*mo), true);
}
else
{
Expand Down

0 comments on commit 6f1b953

Please sign in to comment.