swarm, p2p: Prerequities for ENR replacing handshake (#19275)
* swarm/api, swarm/network, p2p/simulations: Prerequisites for handshake remove * swarm, p2p: Add full sim node configs for protocoltester * swarm/network: Make stream package pass tests * swarm/network: Extract peer and addr types out of protocol file * p2p, swarm: Make p2p/protocols tests pass + rename types.go * swarm/network: Deactivate ExecAdapter test until binary ENR prep * swarm/api: Remove comments * swarm/network: Uncomment bootnode record load
This commit is contained in:
@ -27,6 +27,7 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/p2p"
|
||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||
"github.com/ethereum/go-ethereum/p2p/simulations/adapters"
|
||||
@ -144,8 +145,11 @@ func newProtocol(pp *p2ptest.TestPeerPool) func(*p2p.Peer, p2p.MsgReadWriter) er
|
||||
}
|
||||
|
||||
func protocolTester(pp *p2ptest.TestPeerPool) *p2ptest.ProtocolTester {
|
||||
conf := adapters.RandomNodeConfig()
|
||||
return p2ptest.NewProtocolTester(conf.ID, 2, newProtocol(pp))
|
||||
prvkey, err := crypto.GenerateKey()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return p2ptest.NewProtocolTester(prvkey, 2, newProtocol(pp))
|
||||
}
|
||||
|
||||
func protoHandshakeExchange(id enode.ID, proto *protoHandshake) []p2ptest.Exchange {
|
||||
@ -260,9 +264,12 @@ func TestProtocolHook(t *testing.T) {
|
||||
return peer.Run(handle)
|
||||
}
|
||||
|
||||
conf := adapters.RandomNodeConfig()
|
||||
tester := p2ptest.NewProtocolTester(conf.ID, 2, runFunc)
|
||||
err := tester.TestExchanges(p2ptest.Exchange{
|
||||
prvkey, err := crypto.GenerateKey()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
tester := p2ptest.NewProtocolTester(prvkey, 2, runFunc)
|
||||
err = tester.TestExchanges(p2ptest.Exchange{
|
||||
Expects: []p2ptest.Expect{
|
||||
{
|
||||
Code: 0,
|
||||
|
Reference in New Issue
Block a user