Skip to content

Commit

Permalink
fix: offer test failed in hive state interop
Browse files Browse the repository at this point in the history
  • Loading branch information
fearlessfe authored and GrapeBaBa committed Sep 26, 2024
1 parent eea2d93 commit 316e49f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions p2p/discover/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions portalnetwork/history/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 316e49f

Please sign in to comment.