Skip to content

blocks can be made at any point in time #630

New issue

Have a question about this project? Sign up for a free account to open an issue and contact its maintainers and the community.

By clicking “Sign up for ”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on ? Sign in to your account

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.

@WestladWestlad added DNMDo not mergeand removed DNMDo not mergelabels Apr 27, 2022
@WestladWestlad added the One more approval neededOne reviewer has approved this PR but another is neededlabel Apr 29, 2022
@daverogadaveroga added One more approval neededOne reviewer has approved this PR but another is neededand removed One more approval neededOne reviewer has approved this PR but another is neededlabels Apr 29, 2022
@daverogadaveroga 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

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

Successfully merging this pull request may close these issues.

4 participants