Skip to content

Commit

Permalink
Conditional now (#2350)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilsa authored Jan 24, 2025
1 parent 4958e11 commit 3bbce22
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions core/authority_discovery/publisher/address_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ namespace kagome::authority_discovery {
constexpr std::chrono::seconds kIntervalInitial{2};
constexpr std::chrono::hours kIntervalMax{1};

// TODO(kamilsa): #2351, remove this variable when resolved
constexpr bool kAudiDisableTimestamp = true;

static const metrics::GaugeHelper metric_amount_addresses_last_published{
"kagome_authority_discovery_amount_external_addresses_last_published",
"Number of external addresses published when authority discovery last "
Expand Down Expand Up @@ -125,15 +128,19 @@ namespace kagome::authority_discovery {
return outcome::success();
}

OUTCOME_TRY(
raw,
audiEncode(ed_crypto_provider_,
sr_crypto_provider_,
*libp2p_key_,
*libp2p_key_pb_,
peer_info,
*audi_key,
std::chrono::system_clock::now().time_since_epoch()));
std::optional<std::chrono::nanoseconds> now =
std::chrono::system_clock::now().time_since_epoch();
if (kAudiDisableTimestamp) {
now.reset();
}
OUTCOME_TRY(raw,
audiEncode(ed_crypto_provider_,
sr_crypto_provider_,
*libp2p_key_,
*libp2p_key_pb_,
peer_info,
*audi_key,
now));
auto r = kademlia_->putValue(std::move(raw.first), std::move(raw.second));
MetricDhtEventReceived::get().putResult(r.has_value());
return r;
Expand Down

0 comments on commit 3bbce22

Please sign in to comment.