Skip to content

Commit

Permalink
chore: hookup hare4 handler (#6391)
Browse files Browse the repository at this point in the history
## Motivation

p2p server was not hooked up correctly, causing errors on stream handling.
  • Loading branch information
acud committed Oct 16, 2024
1 parent 12e7085 commit 40fc160
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions hare4/hare.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ func (h *Hare) Coins() <-chan WeakCoinOutput {

func (h *Hare) Start() {
h.pubsub.Register(h.config.ProtocolName, h.Handler, pubsub.WithValidatorInline(true))
h.eg.Go(func() error { return h.p2p.Run(h.ctx) })
current := h.nodeClock.CurrentLayer() + 1
enabled := max(current, h.config.EnableLayer, types.GetEffectiveGenesis()+1)
disabled := types.LayerID(math.MaxUint32)
Expand Down
1 change: 1 addition & 0 deletions hare4/hare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ func (n *node) withPublisher() *node {

func (n *node) withStreamRequester() *node {
n.mockStreamRequester = hmock.NewMockstreamRequester(n.ctrl)
n.mockStreamRequester.EXPECT().Run(gomock.Any()).Return(nil).AnyTimes()
return n
}

Expand Down
1 change: 1 addition & 0 deletions hare4/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
//go:generate mockgen -typed -package=mocks -destination=./mocks/mocks.go -source=./interface.go

type streamRequester interface {
Run(ctx context.Context) error
StreamRequest(context.Context, p2p.Peer, []byte, server.StreamRequestCallback, ...string) error
}

Expand Down
38 changes: 38 additions & 0 deletions hare4/mocks/mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 40fc160

Please sign in to comment.