From e144a53defb92bad82b29795280b1af22b742106 Mon Sep 17 00:00:00 2001 From: thinkAfCod Date: Wed, 6 Mar 2024 21:18:30 +0800 Subject: [PATCH] chore: log when put/get local storage --- p2p/discover/portal_protocol.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/p2p/discover/portal_protocol.go b/p2p/discover/portal_protocol.go index bd659a428f..9e5ab695e2 100644 --- a/p2p/discover/portal_protocol.go +++ b/p2p/discover/portal_protocol.go @@ -1501,11 +1501,15 @@ func (p *PortalProtocol) InRange(contentId []byte) bool { } func (p *PortalProtocol) Get(contentId []byte) ([]byte, error) { - return p.storage.Get(contentId) + content, err := p.storage.Get(contentId) + p.log.Trace("get local storage", "contentId", hexutil.Encode(contentId), "content", hexutil.Encode(content), "err", err) + return content, err } func (p *PortalProtocol) Put(contentId []byte, content []byte) error { - return p.storage.Put(contentId, content) + err := p.storage.Put(contentId, content) + p.log.Trace("put local storage", "contentId", hexutil.Encode(contentId), "content", hexutil.Encode(content), "err", err) + return err } func (p *PortalProtocol) GetContent() <-chan *ContentElement {