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

Abort Block Generation #1

Closed
tabone opened this issue Nov 11, 2017 · 2 comments
Closed

Abort Block Generation #1

tabone opened this issue Nov 11, 2017 · 2 comments

Comments

@tabone
Copy link
Owner

tabone commented Nov 11, 2017

With the current implementation of the module, there is no way to abort the generation of a Block. Such functionality will be needed when implementing blockchain-node module since when a new Block will be received the blockchain-node should abort the current Block generation and start on a new one.

@tabone
Copy link
Owner Author

tabone commented Nov 11, 2017

This change should also introduce states in Blocks, so that a user will be informed when he invokes the abort() function after the Block's hash is generated. Possible states:

  1. INITIALIZING
  2. READY
  3. ABORTED

tabone added a commit that referenced this issue Nov 11, 2017
In this PR changes were implemented to enable a user to abort the generation of
the Block being added in the Blockchain. As discussed in #1, this feature will
be needed for when the blockchain-node is implemented, since when a new Block is
received from another blockchain-node the Block generation needs to be restarted.

In order to achieve this, the Block object was updated to now have the following
states:
  * initializing: block is still working on generating the hash.
  * ready: block has been initialized.
  * aborted: block has been aborted.

In addition to this, a new abort() function was introduced in the Block module,
which as it name implies it will stop the initialization of the Block. Note that
if this function is invoked when the Block is not in the initializing state, it
will emit an error.

With respect to the Blockchain object, the following two functions has been
introduced:
  * abort(): Used to stop the current Block being generated.
  * resume(): Used to resume the Block generation.

When the generation of the current Block is aborted, the Blockchain should:
  * Stop the Block generation process.
  * Re-include the Queued Data of the aborted Block.
@tabone
Copy link
Owner Author

tabone commented Nov 11, 2017

Feature implemented in bb337d8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant