Skip to content
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

blocks can be made at any point in time #630

Merged
merged 1 commit into from
Apr 29, 2022

Conversation

Westlad
Copy link
Contributor

@Westlad Westlad commented Apr 27, 2022

This PR creates a new optimist endpoint /block/make-now (and wrappers it in the Nf3 class method makeBlockNow). When called, optimist will make a 'short' block using whatever transactions it has in its database, even if that is less than TRANSACTIONS_PER_BLOCK. The short block is still made by queuing conditionalMakeBlock in the usual way, so the queue is never bypassed. The new code will not make a block if there are no transactions: there must be at least one. If there are already >=TRANSACTIONS_PER_BLOCK transactions, then calling this endpoint has no effect.

To test, an additional test stanza has been added to the ERC1155 tests, whereby makeBlockNow is called and a single deposit transaction is made. The test then waits for a block to be created. Normally it would wait forever (well, until it times out) but because the end point has been called, a block with a single transaction will be made. you can double check this by looking at the logs and you will find a block with a transactionHashes of length 1, rather than 2.

@Westlad Westlad added DNM Do not merge and removed DNM Do not merge labels Apr 27, 2022
@Westlad Westlad added the One more approval needed One reviewer has approved this PR but another is needed label Apr 29, 2022
@daveroga daveroga added One more approval needed One reviewer has approved this PR but another is needed and removed One more approval needed One reviewer has approved this PR but another is needed labels Apr 29, 2022
@daveroga daveroga self-requested a review April 29, 2022 12:03
Copy link
Contributor

@daveroga daveroga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested successfully

@daveroga daveroga merged commit 1b8d9e3 into master Apr 29, 2022
@Westlad Westlad deleted the westlad/makeblocks-endpoint branch July 26, 2022 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
One more approval needed One reviewer has approved this PR but another is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants