Skip to content

[GH-#88] Refactor chain to be map of blocks, traverse top to bottom#106

Merged
andonov merged 10 commits into
masterfrom
GH-88
Nov 1, 2017
Merged

[GH-#88] Refactor chain to be map of blocks, traverse top to bottom#106
andonov merged 10 commits into
masterfrom
GH-88

Conversation

@cheezus1

@cheezus1 cheezus1 commented Nov 1, 2017

Copy link
Copy Markdown
Contributor

closes #88

@cheezus1 cheezus1 changed the title Gh 88 [GH-#88] Refactor chain to be map of blocks, traverse top to bottom Nov 1, 2017
# Conflicts:
#	apps/aecore/lib/aecore/miner/worker.ex
Comment thread apps/aecore/lib/aecore/chain/worker.ex Outdated
new_block_state = ChainState.calculate_block_state(block.txs)
new_chain_state = ChainState.calculate_chain_state(new_block_state, prev_block_chain_state)

BlockValidation.validate_block!(block, chain[block.header.prev_hash], new_chain_state)

@thepiwo thepiwo Nov 1, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe add the try again

Comment thread apps/aecore/lib/aecore/chain/worker.ex Outdated
chain = elem(state, 0)
{:reply, chain, state}
def handle_call({:get_block_by_hex_hash, hash}, _from, state) do
case(Enum.find(elem(state, 0), fn{block_hash, _block} ->

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use {chain, _} = state instead of elem(state, 0)

# Conflicts:
#	apps/aecore/lib/aecore/chain/worker.ex
@andonov andonov merged commit cc7d42b into master Nov 1, 2017
@thepiwo thepiwo deleted the GH-88 branch October 5, 2018 11:48
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.

refactor chain to be map of blocks, traverse top to bottom

5 participants