Skip to content

Commit b7166f3

Browse files
committed
Refactor pusher engine: merge function with no callers
1 parent b5418dd commit b7166f3

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

engine/collection/pusher/engine.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -171,22 +171,15 @@ func (e *Engine) process(originID flow.Identifier, event interface{}) error {
171171
case *messages.SubmitCollectionGuarantee:
172172
e.engMetrics.MessageReceived(metrics.EngineCollectionProvider, metrics.MessageSubmitGuarantee)
173173
defer e.engMetrics.MessageHandled(metrics.EngineCollectionProvider, metrics.MessageSubmitGuarantee)
174-
return e.onSubmitCollectionGuarantee(originID, ev)
174+
if originID != e.me.NodeID() {
175+
return fmt.Errorf("invalid remote request to submit collection guarantee (from=%x)", originID)
176+
}
177+
return e.SubmitCollectionGuarantee(&ev.Guarantee)
175178
default:
176179
return fmt.Errorf("invalid event type (%T)", event)
177180
}
178181
}
179182

180-
// onSubmitCollectionGuarantee handles submitting the given collection guarantee
181-
// to consensus nodes.
182-
func (e *Engine) onSubmitCollectionGuarantee(originID flow.Identifier, req *messages.SubmitCollectionGuarantee) error {
183-
if originID != e.me.NodeID() {
184-
return fmt.Errorf("invalid remote request to submit collection guarantee (from=%x)", originID)
185-
}
186-
187-
return e.SubmitCollectionGuarantee(&req.Guarantee)
188-
}
189-
190183
// SubmitCollectionGuarantee submits the collection guarantee to all consensus nodes.
191184
func (e *Engine) SubmitCollectionGuarantee(guarantee *flow.CollectionGuarantee) error {
192185
consensusNodes, err := e.state.Final().Identities(filter.HasRole[flow.Identity](flow.RoleConsensus))

0 commit comments

Comments
 (0)