Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Allow schedule_after(0, ...) to work #7284

Merged
3 commits merged into from
Oct 9, 2020
Merged

Conversation

shawntabrizi
Copy link
Member

@shawntabrizi shawntabrizi commented Oct 8, 2020

Right now, if a user puts schedule_after(0, ...), the call will fail because there is a check that the scheduled block must be greater than the current block:

if when <= now {
	return Err(Error::<T>::TargetBlockNumberInPast.into())
}

This PR simply adds one additional block to any schedule_after call. So schedule_after(0, ...) will be the block after the current block, schedule_after(1, ...) will be the block after that, etc... So after this PR, all schedule_after will happen one block later. This allows schedule_after to always pass this check with any after input.

This is just a quality of life improvement which should capture the intention of the caller.

cc @xlc

@shawntabrizi shawntabrizi added A2-insubstantial Pull request requires no code review (e.g., a sub-repository hash update). B7-runtimenoteworthy C1-low PR touches the given topic and has a low impact on builders. labels Oct 8, 2020
@bkchr
Copy link
Member

bkchr commented Oct 9, 2020

@shawntabrizi you need to merge master

@shawntabrizi
Copy link
Member Author

bot merge

@ghost
Copy link

ghost commented Oct 9, 2020

Trying merge.

@ghost ghost merged commit 5698471 into master Oct 9, 2020
@ghost ghost deleted the shawntabrizi-schedule-after-zero branch October 9, 2020 17:20
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A2-insubstantial Pull request requires no code review (e.g., a sub-repository hash update). C1-low PR touches the given topic and has a low impact on builders.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants