Skip to content

Commit

Permalink
fix: no block request message in hello-ack phase
Browse files Browse the repository at this point in the history
  • Loading branch information
themantre committed Oct 1, 2023
1 parent 5526682 commit 6733d6f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 0 additions & 2 deletions sync/handler_hello_ack.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ func (handler *helloAckHandler) ParseMessage(m message.Message, initiator peer.I
handler.logger.Debug("hello message acknowledged",
"from", initiator.ShortString())

handler.updateBlockchain()

return nil
}

Expand Down
8 changes: 2 additions & 6 deletions sync/handler_hello_ack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,26 @@ import (

"github.com/pactus-project/pactus/sync/bundle/message"
"github.com/pactus-project/pactus/sync/peerset"
"github.com/pactus-project/pactus/sync/services"
"github.com/stretchr/testify/assert"
)

func TestParsingHelloAckMessages(t *testing.T) {
td := setup(t, nil)

t.Run("Receiving HelloAck message: Rejected hello",
t.Run("Receiving HelloAck message: Rejected",
func(t *testing.T) {
pid := td.RandPeerID()
msg := message.NewHelloAckMessage(message.ResponseCodeRejected, "rejected")

assert.NoError(t, td.receivingNewMessage(td.sync, msg, pid))
})

t.Run("Receiving HelloAck message: OK hello",
t.Run("Receiving HelloAck message: OK",
func(t *testing.T) {
pid := td.RandPeerID()
pub, _ := td.RandBLSKeyPair()
td.addPeer(t, pub, pid, services.New(services.Network))
msg := message.NewHelloAckMessage(message.ResponseCodeOK, "ok")

assert.NoError(t, td.receivingNewMessage(td.sync, msg, pid))
td.checkPeerStatus(t, pid, peerset.StatusCodeKnown)
shouldPublishMessageWithThisType(t, td.network, message.TypeBlocksRequest)
})
}

0 comments on commit 6733d6f

Please sign in to comment.