Skip to content

Conversation

sukrawidhyawan
Copy link
Contributor

@sukrawidhyawan sukrawidhyawan commented Jul 30, 2019

Description

Implement Observer Pattern (for now used core services to & from p2p service). Add SendBlock & SendTransaction in p2pCommunication service to receive or send block & transaction to each peer

Breakdown

  • Add observerpackage
  • Add SendBlock & SendTransaction in p2pCommunication service
  • Add BlockPushed listener : Call when has new block pushed ( and will send to peers)
  • Add BlockReceived listener : Call when received block from another peer
  • Add TransactionAdded listener: Call when new transaction inserted in mempool
  • Add TransactionReceived listener: Call when received new transaction from another peer
  • Add unit test

Reference Issue

Closes #69 #70

Step to Test (optional)

  • Test Block Broadcast :
    • Delete all file with extention .db in ./resource path
    • Open 2 separate terminal tabs
    • Run go run main.go -config-postfix 2 in first tab terminal
    • Then run go run main.go in second terminal
    • Compare data block beetween zoobc_2.db with zoobc.db . (zoobc_2.db act as receiver and zoobc.db act as block creator and send block to listed peer)

  • Test Transaction Broadcast :
    • Open 3 separate terminal tabs
    • Run go run main.go -config-postfix 2 in first tab terminal
    • Then run go run main.go in second terminal
    • Then run client.go in ./api/client/PostTransaction path in third terminal
    • When run client.go new transaction will save mempol in zoobc.db and broadcast to the listed peer
    • Compare data mempol beetween zoobc_2.db with zoobc.db .

Copy link
Contributor

@andy-shi88 andy-shi88 left a comment

Choose a reason for hiding this comment

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

Neat! 👍 , added some comment answering the block signature verification todo comment and some typo in constant

@andy-shi88 andy-shi88 removed the request for review from eksant July 31, 2019 00:38
@sukrawidhyawan sukrawidhyawan changed the title Block broadcast Block & Transaction broadcast Jul 31, 2019
Copy link
Contributor

@astaphobia astaphobia left a comment

Choose a reason for hiding this comment

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

waiting for test files

@sukrawidhyawan
Copy link
Contributor Author

Please Review zoobc-schema/pull/28

@sukrawidhyawan sukrawidhyawan marked this pull request as ready for review July 31, 2019 10:31
@sukrawidhyawan sukrawidhyawan requested a review from iltoga July 31, 2019 11:14
@sukrawidhyawan sukrawidhyawan removed the WIP label Aug 1, 2019
@astaphobia astaphobia merged commit 5c5fa6f into develop Aug 1, 2019
@astaphobia astaphobia deleted the 69-Block-Broadcast branch August 1, 2019 04:20
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.

Tech: Block Broadcast
4 participants