Skip to content

blockchain: Store side chain blocks in database.#1000

Merged
davecgh merged 1 commit intodecred:masterfrom
davecgh:blockchain_store_side_chain_blocks
Feb 18, 2018
Merged

blockchain: Store side chain blocks in database.#1000
davecgh merged 1 commit intodecred:masterfrom
davecgh:blockchain_store_side_chain_blocks

Conversation

@davecgh
Copy link
Copy Markdown
Member

@davecgh davecgh commented Jan 31, 2018

This modifies the blockchain code to store all blocks that have passed proof-of-work and contextual validity tests in the database even if they may ultimately fail to connect.

This eliminates the need to store those blocks in memory, allows them to be available as orphans later even if they were never part of the main chain, and helps pave the way toward being able to separate the download logic from the connection logic.

Note that it also updates the blockExists function since the code base is currently in the process of changing over to decouple download and connection logic, but not all of the necessary parts are updated yet, to ensure blocks that are in the database, but do not have an associated main chain block index entry, are treated as if they do not exist for the purposes of chain connection and selection logic.

@davecgh davecgh force-pushed the blockchain_store_side_chain_blocks branch from c2865cd to 6e66b23 Compare January 31, 2018 18:38
alexlyp
alexlyp previously approved these changes Jan 31, 2018
@davecgh davecgh force-pushed the blockchain_store_side_chain_blocks branch from 6e66b23 to a5b9be8 Compare January 31, 2018 23:46
@dajohi dajohi changed the title blockchain: Store side chain blocks in database. WIP: blockchain: Store side chain blocks in database. Feb 1, 2018
@alexlyp alexlyp dismissed their stale review February 1, 2018 22:34

Changed to WIP

@davecgh davecgh force-pushed the blockchain_store_side_chain_blocks branch 3 times, most recently from 5681e87 to 925ef29 Compare February 16, 2018 04:26
@davecgh davecgh changed the title WIP: blockchain: Store side chain blocks in database. blockchain: Store side chain blocks in database. Feb 16, 2018
Copy link
Copy Markdown
Member

@dajohi dajohi left a comment

Choose a reason for hiding this comment

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

ok

This modifies the blockchain code to store all blocks that have passed
proof-of-work and contextual validity tests in the database even if they
may ultimately fail to connect.

This eliminates the need to store those blocks in memory, allows them to
be available as orphans later even if they were never part of the main
chain, and helps pave the way toward being able to separate the download
logic from the connection logic.

Note that it also updates the blockExists function since the code base
is currently in the process of changing over to decouple download and
connection logic, but not all of the necessary parts are updated yet,
to ensure blocks that are in the database, but do not have an associated
main chain block index entry, are treated as if they do not exist for
the purposes of chain connection and selection logic.
@davecgh davecgh force-pushed the blockchain_store_side_chain_blocks branch from 925ef29 to d967408 Compare February 18, 2018 16:31
@davecgh davecgh merged commit d967408 into decred:master Feb 18, 2018
@davecgh davecgh deleted the blockchain_store_side_chain_blocks branch February 18, 2018 16:49
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

Successfully merging this pull request may close these issues.

3 participants