Skip to content

Commit

Permalink
prevent trust period from going to zero with a small unbonding time (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sampocs authored and agouin committed Jan 30, 2023
1 parent 9b359d4 commit 80b0ac1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion relayer/chains/cosmos/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,12 @@ func (cc *CosmosProvider) TrustingPeriod(ctx context.Context) (time.Duration, er
tp := res.UnbondingTime / 100 * 85

// And we only want the trusting period to be whole hours.
return tp.Truncate(time.Hour), nil
// But avoid rounding if the time is less than 1 hour
// (otherwise the trusting period will go to 0)
if tp > time.Hour {
tp = tp.Truncate(time.Hour)
}
return tp, nil
}

// Sprint returns the json representation of the specified proto message.
Expand Down

0 comments on commit 80b0ac1

Please sign in to comment.