Skip to content

Conversation

cheezus1
Copy link
Contributor

@cheezus1 cheezus1 commented Nov 1, 2017

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
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)
Copy link
Collaborator

@thepiwo thepiwo Nov 1, 2017

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

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
Collaborator

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

6 participants