Skip to content

Commit

Permalink
Fix bug in ISS SB message validation
Browse files Browse the repository at this point in the history
Signed-off-by: Matej Pavlovic <matopavlovic@gmail.com>
  • Loading branch information
matejpavlovic committed Aug 26, 2022
1 parent 8e480ad commit d838b42
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/iss/epochinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ func newEpochInfo(
// If validation fails, returns the reason for which the message is considered invalid.
func (e *epochInfo) validateSBMessage(message *isspb.SBMessage, from t.NodeID) error {

// Message must be destined for the current epoch.
// Message must be destined for this epoch.
if t.EpochNr(message.Epoch) != e.Nr {
return fmt.Errorf("invalid epoch: %v (expected %v)", message.Epoch, e.Nr)
}

// Message must refer to a valid SB instance.
if int(message.Instance) > len(e.Orderers) {
if int(message.Instance) >= len(e.Orderers) {
return fmt.Errorf("invalid SB instance number: %d", message.Instance)
}

Expand Down

0 comments on commit d838b42

Please sign in to comment.