Skip to content

146 receipt #195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Sep 11, 2019
Merged

146 receipt #195

merged 32 commits into from
Sep 11, 2019

Conversation

andy-shi88
Copy link
Contributor

@andy-shi88 andy-shi88 commented Aug 29, 2019

Description

Add receipt functionality and refactor p2p module.

Breakdown

  • Generate receipt
  • Receipt Block
  • Receipt Transaction
  • Refactor p2p module
  • Refactor Blockchain sync
  • receipt tests
  • refactored tests

Test recovered

  • p2p/util
  • p2p/strategy
  • p2p/service
  • p2p/client
  • core/blockchainSync

Reference Issue

Close #146

Step to Test (optional)

  • go test ./...

  • Functionality

  • run second node: go run main.go --config-postfix 2

  • run main node (smithing=true): go run main.go

  • it should:

    • when main node create block, and broadcast, second node will send receipt, and main node will save them. Currently no validation of receipt is done.
    • when we post transaction to second node (no smithing) it will broadcast transaction and get receipt from main node, (also no validation done yet). When main node smithed a block and broadcast to second node, both mempool will be emptied. (This does not work with download block yet, since the download block haven't include the transactions of block, I believe @capt4ce has this fixed in his current work, so not bother to tweak it).

}

func startServices(queryExecutor query.ExecutorInterface, ownerAccountAddress string) {
startP2pService()
func startServices() {
Copy link
Contributor

Choose a reason for hiding this comment

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

🚀

p2p/p2p.go Outdated
mempoolServices map[int32]coreService.MempoolServiceInterface,
) {
// initialize log
p2pLogger, err := util.InitLogger(".log/", "debug.log")
Copy link
Contributor

Choose a reason for hiding this comment

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

need to specify log levels, LINK

Copy link
Contributor Author

Choose a reason for hiding this comment

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

noted

Copy link
Contributor Author

Choose a reason for hiding this comment

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

may need to pull the latest develop branch, on it.

nodeSecretPhrase,
)
// start listening on peer port
go func() { // register handlers and listening to incoming p2p request
Copy link
Contributor

Choose a reason for hiding this comment

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

should we put gorountines :87-99 to single goroutine? how about that ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice idea, updating

@andy-shi88 andy-shi88 marked this pull request as ready for review September 3, 2019 05:16
@andy-shi88
Copy link
Contributor Author

This PR is for #146 send receipt,

For collecting receipt right now it just store everything to node_receipt table, but it should save as batch first before saving to node_receipt and merkle_root table, but that'll be in #202 . For this PR we'll just focus on sending receipt when receiving a certain data.


configPath := viper.GetString("configPath")
nodeKeyFile := viper.GetString("nodeKeyFile")
smithing = viper.GetBool("smithing")
Copy link
Contributor

Choose a reason for hiding this comment

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

do we still need this boolean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes until fully integrated to node registry for smithing

@capt4ce
Copy link
Contributor

capt4ce commented Sep 10, 2019

The Download blockchain process in #220 has already included transactions into the blocks to be downloaded

@astaphobia astaphobia merged commit f8005b3 into zoobc:develop Sep 11, 2019
@astaphobia astaphobia deleted the 146-receipt branch September 11, 2019 02:51
@andy-shi88 andy-shi88 removed their assignment Dec 10, 2020
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: Send Receipt
6 participants