fix HandshakeIncompatibleVersion test

This commit is contained in:
Sergey Cherepanov 2023-06-09 19:28:09 +02:00
parent e97e6b68c6
commit 89afc03218
No known key found for this signature in database
GPG Key ID: 87F8EDE8FBDF637C
2 changed files with 5 additions and 3 deletions

View File

@ -53,7 +53,9 @@ type secureService struct {
}
func (s *secureService) Init(a *app.App) (err error) {
s.protoVersion = ProtoVersion
if s.protoVersion == 0 {
s.protoVersion = ProtoVersion
}
account := a.MustComponent(commonaccount.CName).(commonaccount.Service)
peerKey, err := account.Account().PeerKey.Raw()
if err != nil {

View File

@ -57,7 +57,7 @@ func TestHandshake(t *testing.T) {
func TestHandshakeIncompatibleVersion(t *testing.T) {
nc := testnodeconf.GenNodeConfig(2)
fxS := newFixture(t, nc, nc.GetAccountService(0), 0)
fxS := newFixture(t, nc, nc.GetAccountService(0), 1)
defer fxS.Finish(t)
sc, cc := net.Pipe()
@ -72,7 +72,7 @@ func TestHandshakeIncompatibleVersion(t *testing.T) {
ar.ctx, ar.err = fxS.SecureInbound(ctx, sc)
resCh <- ar
}()
fxC := newFixture(t, nc, nc.GetAccountService(1), 1)
fxC := newFixture(t, nc, nc.GetAccountService(1), 2)
defer fxC.Finish(t)
_, err := fxC.SecureOutbound(ctx, cc)
require.Equal(t, handshake.ErrIncompatibleVersion, err)