From 15fbfdebcc6d0b868d3c4aec3ca4f22f98235032 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Fri, 22 May 2020 12:28:25 -0400
Subject: [PATCH] dht: only load id if set in configuration

---
 src/dht.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/dht.cpp b/src/dht.cpp
index f59041b9..72ec2dd1 100644
--- a/src/dht.cpp
+++ b/src/dht.cpp
@@ -2550,7 +2550,8 @@ Dht::loadState(const std::string& path)
             auto state = oh.get().as<DhtState>();
             if (logger_)
                 logger_->d("Importing %zu nodes", state.nodes.size());
-            myid = state.id;
+            if (state.id)
+                myid = state.id;
             std::vector<Sp<Node>> tmpNodes;
             tmpNodes.reserve(state.nodes.size());
             for (const auto& node : state.nodes)
-- 
GitLab