diff --git a/p2p/discover/api.go b/p2p/discover/api.go index a932bdb2b490..ed306f312f88 100644 --- a/p2p/discover/api.go +++ b/p2p/discover/api.go @@ -468,6 +468,16 @@ func (p *PortalProtocolAPI) RecursiveFindContent(contentKeyHex string) (*Content return nil, err } contentId := p.portalProtocol.toContentId(contentKey) + + data, err := p.portalProtocol.Get(contentKey, contentId) + if err == nil { + return &ContentInfo{ + Content: hexutil.Encode(data), + UtpTransfer: false, + }, err + } + p.portalProtocol.Log.Warn("find content err", "contextKey", hexutil.Encode(contentKey), "err", err) + content, utpTransfer, err := p.portalProtocol.ContentLookup(contentKey, contentId) if err != nil { diff --git a/portalnetwork/history/storage.go b/portalnetwork/history/storage.go index 70ccadfc1109..9844f96f8976 100644 --- a/portalnetwork/history/storage.go +++ b/portalnetwork/history/storage.go @@ -12,6 +12,7 @@ import ( "sync" "sync/atomic" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/portalnetwork/storage" @@ -120,6 +121,7 @@ func NewHistoryStorage(config storage.PortalStorageConfig) (storage.ContentStora // Get the content according to the contentId func (p *ContentStorage) Get(contentKey []byte, contentId []byte) ([]byte, error) { + p.log.Trace("get content", "contentKey", hexutil.Encode(contentKey), "contentId", hexutil.Encode(contentId)) var res []byte err := p.getStmt.QueryRow(contentId).Scan(&res) if errors.Is(err, sql.ErrNoRows) {