-
Notifications
You must be signed in to change notification settings - Fork 320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SEP-10: Accept challenge transactions through clock drift #667
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One change request, otherwise looks great. Thanks for adding a solid test.
src/utils.ts
Outdated
@@ -639,8 +639,12 @@ export namespace Utils { | |||
const now = Math.floor(Date.now() / 1000); | |||
const { minTime, maxTime } = transaction.timeBounds; | |||
|
|||
// give a small grace period for the transaction time to account for clock drift | |||
const gracePeriod = 60 * 5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make this a parameter of the function, and pass the value in from the SEP-10 read function? This function is only used by the SEP-10 code today, but it is rather generic and the 5 minute time is appropriate for SEP-10 but may not be appropriate for other use cases.
Accept challenge transactions that are 5 minutes off from their min and max time, to account for client clocks not matching server clocks.