mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-16 08:53:46 +00:00
fix: offer test failed in hive state interop
This commit is contained in:
parent
eea2d93f38
commit
316e49fca8
2 changed files with 12 additions and 0 deletions
|
|
@ -468,6 +468,16 @@ func (p *PortalProtocolAPI) RecursiveFindContent(contentKeyHex string) (*Content
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
contentId := p.portalProtocol.toContentId(contentKey)
|
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)
|
content, utpTransfer, err := p.portalProtocol.ContentLookup(contentKey, contentId)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||||
"github.com/ethereum/go-ethereum/portalnetwork/storage"
|
"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
|
// Get the content according to the contentId
|
||||||
func (p *ContentStorage) Get(contentKey []byte, contentId []byte) ([]byte, error) {
|
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
|
var res []byte
|
||||||
err := p.getStmt.QueryRow(contentId).Scan(&res)
|
err := p.getStmt.QueryRow(contentId).Scan(&res)
|
||||||
if errors.Is(err, sql.ErrNoRows) {
|
if errors.Is(err, sql.ErrNoRows) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue