Skip to content

[GH-114] Refactoring of serialization#151

Merged
thepiwo merged 5 commits into
masterfrom
GH-114
Dec 12, 2017
Merged

[GH-114] Refactoring of serialization#151
thepiwo merged 5 commits into
masterfrom
GH-114

Conversation

@cytadela8

Copy link
Copy Markdown
Contributor

This PR:

  • creates Aeutil application and moves serialization code to it.
  • moves invocations of Aeutil.Serialization to Aehttpclient
  • moves other request related code to Aehttpclient

This closes #114


if(block_hash == Base.encode16(peer_block_hash)) do
check_peer_block(peer_uri, peer_block.header.prev_hash,
check_peer_block(peer_uri, Serialization.hex_binary(deserialized_block.header.prev_hash, :serialize),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Here I had to do a little bit dirty fix, because we use hex encoded hashes in requests and hex encoded hash is passed to check_peer_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.

internally I'd prefer to only pass binary, we should only introduce other encodings at the last point needed

Comment thread apps/aecore/lib/aecore/chain/worker.ex Outdated

## Block was validated, now we can send it to other peers
Peers.broadcast_to_all({:new_block, block})
Client.broadcast_block(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.

I'd like to divide the client as much from the rest of the code as possible. Only the Peers Worker should know about the HTTP-Client Interface

case tx_pool == updated_pool do
true -> Logger.info(" This transaction already has been added")
false -> Peers.broadcast_to_all({:new_tx, tx})
false -> Client.broadcast_tx(tx)

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.

Again, only the Peers should know about the Client

@thepiwo

thepiwo commented Dec 11, 2017

Copy link
Copy Markdown
Contributor

@meivantodorov can you approve and merge?

@thepiwo thepiwo merged commit dcfb1b4 into master Dec 12, 2017
@thepiwo thepiwo deleted the GH-114 branch October 5, 2018 11:53
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 serialization to be in aeutil

3 participants