From d94aa5335297bbf81e0d9452818e1c6197c6d52f Mon Sep 17 00:00:00 2001 From: Toralf Wittner Date: Wed, 19 Feb 2020 21:00:16 +0100 Subject: [PATCH] Log kademlia errors when get/put record fails. (#4988) * Log kademlia errors when get/put record fails. The current approach makes it difficult to figure out what the underlying error was, that made the operation fail. * Formatting Co-Authored-By: Pierre Krieger Co-authored-by: Pierre Krieger --- substrate/client/network/src/discovery.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/substrate/client/network/src/discovery.rs b/substrate/client/network/src/discovery.rs index a236ceb1a8..8360fce518 100644 --- a/substrate/client/network/src/discovery.rs +++ b/substrate/client/network/src/discovery.rs @@ -391,7 +391,14 @@ impl NetworkBehaviour for DiscoveryBehaviour { DiscoveryOut::ValueFound(results) } + Err(e @ libp2p::kad::GetRecordError::NotFound { .. }) => { + trace!(target: "sub-libp2p", + "Libp2p => Failed to get record: {:?}", e); + DiscoveryOut::ValueNotFound(e.into_key()) + } Err(e) => { + warn!(target: "sub-libp2p", + "Libp2p => Failed to get record: {:?}", e); DiscoveryOut::ValueNotFound(e.into_key()) } }; @@ -401,6 +408,8 @@ impl NetworkBehaviour for DiscoveryBehaviour { let ev = match res { Ok(ok) => DiscoveryOut::ValuePut(ok.key), Err(e) => { + warn!(target: "sub-libp2p", + "Libp2p => Failed to put record: {:?}", e); DiscoveryOut::ValuePutFailed(e.into_key()) } };