Skip to content

Commit

Permalink
Increase INACTIVE_SHARD_TTL
Browse files Browse the repository at this point in the history
Node in overlay should be available until peer is expired
  • Loading branch information
SpyCheese committed Jul 14, 2023
1 parent 8e85bfa commit 96afdc1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions overlay/overlay-peers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void OverlayImpl::add_peer_in(OverlayNode node) {
return;
}
auto t = td::Clocks::system();
if (node.version() + 600 < t || node.version() > t + 60) {
if (node.version() + Overlays::overlay_peer_ttl() < t || node.version() > t + 60) {
VLOG(OVERLAY_INFO) << this << ": ignoring node of too old version " << node.version();
return;
}
Expand Down Expand Up @@ -231,7 +231,7 @@ void OverlayImpl::update_neighbours(td::uint32 nodes_to_change) {
continue;
}

if (X->get_version() <= td::Clocks::system() - 600) {
if (X->get_version() <= td::Clocks::system() - Overlays::overlay_peer_ttl()) {
if (X->is_neighbour()) {
bool found = false;
for (auto &n : neighbours_) {
Expand Down
4 changes: 4 additions & 0 deletions overlay/overlays.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ class Overlays : public td::actor::Actor {
return 1;
}

static constexpr td::uint32 overlay_peer_ttl() {
return 600;
}

static td::actor::ActorOwn<Overlays> create(std::string db_root, td::actor::ActorId<keyring::Keyring> keyring,
td::actor::ActorId<adnl::Adnl> adnl, td::actor::ActorId<dht::Dht> dht);

Expand Down
2 changes: 1 addition & 1 deletion validator/full-node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace validator {

namespace fullnode {

static const double INACTIVE_SHARD_TTL = 120.0;
static const double INACTIVE_SHARD_TTL = (double)overlay::Overlays::overlay_peer_ttl() + 60.0;

void FullNodeImpl::add_permanent_key(PublicKeyHash key, td::Promise<td::Unit> promise) {
if (local_keys_.count(key)) {
Expand Down

0 comments on commit 96afdc1

Please sign in to comment.