Skip to content

Commit

Permalink
Do not rebuild API if same version of latest or committed matches
Browse files Browse the repository at this point in the history
  • Loading branch information
karimodm committed Oct 19, 2023
1 parent bdd60ae commit 35c8cdc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/epoch_based_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ func (e *EpochBasedProvider) AddFutureVersion(version iotago.Version, protocolPa
}

func (e *EpochBasedProvider) apiForVersion(version iotago.Version) (iotago.API, error) {
if latestAPI := e.LatestAPI(); latestAPI != nil && latestAPI.Version() == version {
return latestAPI, nil
}

if committedAPI := e.CommittedAPI(); committedAPI != nil && committedAPI.Version() == version {
return committedAPI, nil
}

protocolParams, exists := e.protocolParametersByVersion[version]
if !exists {
return nil, ierrors.Errorf("protocol parameters for version %d are not set", version)
Expand Down

0 comments on commit 35c8cdc

Please sign in to comment.