fix: offer test failed in hive state interop

This commit is contained in:
fearlessfe 2024-09-24 23:00:34 +08:00 committed by Chen Kai
parent eea2d93f38
commit 316e49fca8
2 changed files with 12 additions and 0 deletions

View file

@ -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 {

View file

@ -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) {