fix: replace assert to require

This commit is contained in:
thinkAfCod 2024-10-23 17:10:31 +08:00 committed by Chen Kai
parent b44ca3c190
commit a75e981c5b
2 changed files with 3 additions and 1 deletions

View file

@ -1860,11 +1860,13 @@ func (p *PortalProtocol) Gossip(srcNodeId *enode.ID, contentKeys [][]byte, conte
maxClosestNodes := 4
maxFartherNodes := 4
closestLocalNodes := p.findNodesCloseToContent(contentId, 32)
p.Log.Debug("closest local nodes", "count", len(closestLocalNodes))
gossipNodes := make([]*enode.Node, 0)
for _, n := range closestLocalNodes {
radius, found := p.radiusCache.HasGet(nil, []byte(n.ID().String()))
if found {
p.Log.Debug("found closest local nodes", "nodeId", n.ID(), "addr", n.IPAddr().String())
nodeRadius := new(uint256.Int)
err := nodeRadius.UnmarshalSSZ(radius)
if err != nil {

View file

@ -21,7 +21,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p/discover/portalwire"
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/stretchr/testify/assert"
assert "github.com/stretchr/testify/require"
)
func setupLocalPortalNode(addr string, bootNodes []*enode.Node) (*PortalProtocol, error) {