Skip to content

Commit

Permalink
Add comment to safemath.SafeSub usage
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsporn committed Nov 6, 2023
1 parent 885ff43 commit 2394969
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/protocol/engine/ledger/ledger/ledger.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (l *Ledger) CommitSlot(slot iotago.SlotIndex) (stateRoot iotago.Identifier,
// Update the Accounts ledger
// first, get the RMC corresponding to this slot
protocolParams := l.apiProvider.APIForSlot(slot).ProtocolParameters()
rmcSlot, _ := safemath.SafeSub(slot, protocolParams.MaxCommittableAge())
rmcSlot, _ := safemath.SafeSub(slot, protocolParams.MaxCommittableAge()) // We can safely ignore the underflow error and use the default 0 return value
if rmcSlot < protocolParams.GenesisSlot() {
rmcSlot = protocolParams.GenesisSlot()
}
Expand Down

0 comments on commit 2394969

Please sign in to comment.