Skip to content

Commit 664125d

Browse files
Remove requestID expectation for UnrequestedOps (#3989)
1 parent 0d740bf commit 664125d

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

message/fields.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,9 @@ type requestIDGetter interface {
8383

8484
func GetRequestID(m any) (uint32, bool) {
8585
if msg, ok := m.(requestIDGetter); ok {
86-
requestID := msg.GetRequestId()
87-
return requestID, true
86+
return msg.GetRequestId(), true
8887
}
89-
90-
// AppGossip is the only inbound message not containing a requestID. For
91-
// ease of handling, imagine that it does have a requestID.
92-
_, ok := m.(*p2p.AppGossip)
93-
return 0, ok
88+
return 0, false
9489
}
9590

9691
type engineTypeGetter interface {

snow/networking/router/chain_router.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -221,18 +221,6 @@ func (cr *ChainRouter) HandleInbound(ctx context.Context, msg message.InboundMes
221221
return
222222
}
223223

224-
requestID, ok := message.GetRequestID(m)
225-
if !ok {
226-
cr.log.Debug("dropping message with invalid field",
227-
zap.Stringer("nodeID", nodeID),
228-
zap.Stringer("messageOp", op),
229-
zap.String("field", "RequestID"),
230-
)
231-
232-
msg.OnFinishedHandling()
233-
return
234-
}
235-
236224
cr.lock.Lock()
237225
defer cr.lock.Unlock()
238226

@@ -296,6 +284,18 @@ func (cr *ChainRouter) HandleInbound(ctx context.Context, msg message.InboundMes
296284
return
297285
}
298286

287+
requestID, ok := message.GetRequestID(m)
288+
if !ok {
289+
cr.log.Debug("dropping message with invalid field",
290+
zap.Stringer("nodeID", nodeID),
291+
zap.Stringer("messageOp", op),
292+
zap.String("field", "RequestID"),
293+
)
294+
295+
msg.OnFinishedHandling()
296+
return
297+
}
298+
299299
if expectedResponse, isFailed := message.FailedToResponseOps[op]; isFailed {
300300
// Create the request ID of the request we sent that this message is in
301301
// response to.

0 commit comments

Comments
 (0)