Skip to content

Commit a307899

Browse files
authored
fix: guard against a nil roll forward message (#790)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 7e0a43b commit a307899

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

protocol/chainsync/server.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ func (s *Server) RollForward(blockType uint, blockData []byte, tip Tip) error {
135135
blockData,
136136
tip,
137137
)
138+
if msg == nil {
139+
s.Protocol.Logger().
140+
Error(
141+
"failed to create roll forward message",
142+
"component", "network",
143+
"protocol", ProtocolName,
144+
"role", "server",
145+
"connection_id", s.callbackContext.ConnectionId.String(),
146+
)
147+
return fmt.Errorf("failed to create roll forward message")
148+
}
138149
return s.SendMessage(msg)
139150
}
140151
}

0 commit comments

Comments
 (0)