diff --git a/cmd/shisui/main.go b/cmd/shisui/main.go index 41655d797776..56f2e40adb8c 100644 --- a/cmd/shisui/main.go +++ b/cmd/shisui/main.go @@ -137,8 +137,7 @@ func startPortalRpcServer(config Config, conn discover.UDPConn, addr string) err Addr: addr, Handler: server, } - httpServer.ListenAndServe() - return nil + return httpServer.ListenAndServe() } func initDiscV5(config Config, conn discover.UDPConn) (*discover.UDPv5, *enode.LocalNode, error) { diff --git a/p2p/discover/portal_protocol.go b/p2p/discover/portal_protocol.go index 47225b46e099..b0b1c7f858ba 100644 --- a/p2p/discover/portal_protocol.go +++ b/p2p/discover/portal_protocol.go @@ -406,7 +406,7 @@ func (p *PortalProtocol) pingInner(node *enode.Node) (*portalwire.Pong, error) { talkResp, err := p.DiscV5.TalkRequest(node, p.protocolId, talkRequestBytes) if err != nil { - p.Log.Error("ping error:", err) + p.Log.Error("ping error:", "ip", node.IP().String(), "port", node.UDP(), "err", err) p.replaceNode(node) return nil, err } @@ -439,7 +439,7 @@ func (p *PortalProtocol) findNodes(node *enode.Node, distances []uint) ([]*enode talkResp, err := p.DiscV5.TalkRequest(node, p.protocolId, talkRequestBytes) if err != nil { - p.Log.Error("failed to send find nodes request", "err", err) + p.Log.Error("failed to send find nodes request", "ip", node.IP().String(), "port", node.UDP(), "err", err) return nil, err } @@ -464,7 +464,7 @@ func (p *PortalProtocol) findContent(node *enode.Node, contentKey []byte) (byte, talkResp, err := p.DiscV5.TalkRequest(node, p.protocolId, talkRequestBytes) if err != nil { - p.Log.Error("failed to send find content request", "err", err) + p.Log.Error("failed to send find content request", "ip", node.IP().String(), "port", node.UDP(), "err", err) return 0xff, nil, err } @@ -1473,8 +1473,14 @@ func (p *PortalProtocol) contentLookupWorker(n *enode.Node, contentKey []byte, r wrapedNode := make([]*node, 0) flag, content, err := p.findContent(n, contentKey) if err != nil { + p.Log.Error("contentLookupWorker failed", "ip", n.IP().String(), "err", err) return nil, err } + p.Log.Debug("contentLookupWorker reveice response", "ip", n.IP().String(), "flag", flag) + // has find content + if len(resChan) > 0 { + return []*node{}, nil + } switch flag { case portalwire.ContentRawSelector, portalwire.ContentConnIdSelector: content, ok := content.([]byte) @@ -1609,6 +1615,12 @@ func (p *PortalProtocol) traceContentLookupWorker(n *enode.Node, contentKey []by if err != nil { return nil, err } + p.Log.Debug("traceContentLookupWorker reveice response", "ip", n.IP().String(), "flag", flag) + // has find content + if len(resChan) > 0 { + return []*node{}, nil + } + switch flag { case portalwire.ContentRawSelector, portalwire.ContentConnIdSelector: content, ok := content.([]byte) diff --git a/portalnetwork/history/accumulator_test.go b/portalnetwork/history/accumulator_test.go index d2c15d169ded..ca92ce56cdf7 100644 --- a/portalnetwork/history/accumulator_test.go +++ b/portalnetwork/history/accumulator_test.go @@ -92,6 +92,11 @@ func TestVerifyPostMergePreCapellaHeader(t *testing.T) { require.NoError(t, err) require.True(t, uint64(len(acc.HistoricalRoots)) < uint64(configs.Mainnet.HISTORICAL_ROOTS_LIMIT)) + root := acc.HistoricalRoots.HashTreeRoot(configs.Mainnet, tree.GetHashFn()) + hexutil.Encode(root[:]) + + require.Equal(t, hexutil.Encode(root[:]), "0x4df6b89755125d4f6c5575039a04e22301a5a49ee893c1d27e559e3eeab73da7") + file, err := os.ReadFile("./testdata/block_proofs_bellatrix/beacon_block_proof-15539558-cdf9ed89b0c43cda17398dc4da9cfc505e5ccd19f7c39e3b43474180f1051e01.yaml") require.NoError(t, err) proof := HistoricalRootsBlockProof{}