Skip to content

Commit 9f61563

Browse files
authored
kademlia random walk method (#245)
Signed-off-by: turuslan <[email protected]>
1 parent 9f6f00f commit 9f61563

4 files changed

Lines changed: 6 additions & 5 deletions

File tree

cmake/Hunter/init.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ set(
3131
include(${CMAKE_CURRENT_LIST_DIR}/HunterGate.cmake)
3232

3333
HunterGate(
34-
URL https://github.com/qdrvm/hunter/archive/refs/tags/v0.25.3-qdrvm6.zip
35-
SHA1 5a911c0b567aba49a7140c1d2fe0e4b6769d070f
34+
URL https://github.com/qdrvm/hunter/archive/refs/tags/v0.25.3-qdrvm9.zip
35+
SHA1 7f3f8ee341aaac8c400e776c8a9f28e8fc458296
3636
LOCAL
3737
)

include/libp2p/protocol/kademlia/impl/kademlia_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ namespace libp2p::protocol::kademlia {
114114
std::shared_ptr<FindPeerExecutor> createFindPeerExecutor(
115115
PeerId peer_id, FoundPeerInfoHandler handler) override;
116116

117-
outcome::result<void> findRandomPeer();
117+
outcome::result<void> findRandomPeer() override;
118118
void randomWalk();
119119

120120
// --- Primary (Injected) ---

include/libp2p/protocol/kademlia/peer_routing.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ namespace libp2p::protocol::kademlia {
2626
/// with relevant addresses.
2727
virtual outcome::result<void> findPeer(const PeerId &peer_id,
2828
FoundPeerInfoHandler handler) = 0;
29+
30+
/// Random walk step. Calls `findPeer` with random bytes as key.
31+
virtual outcome::result<void> findRandomPeer() = 0;
2932
};
3033

3134
} // namespace libp2p::protocol::kademlia

src/protocol/kademlia/impl/kademlia_impl.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,6 @@ namespace libp2p::protocol::kademlia {
533533
}
534534

535535
outcome::result<void> KademliaImpl::findRandomPeer() {
536-
BOOST_ASSERT(config_.randomWalk.enabled);
537-
538536
common::Hash256 hash;
539537
random_generator_->fillRandomly(hash);
540538

0 commit comments

Comments
 (0)