-
Notifications
You must be signed in to change notification settings - Fork 321
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
make creating genesis block independent of addr and sig #157
make creating genesis block independent of addr and sig #157
Conversation
Codecov Report
@@ Coverage Diff @@
## master #157 +/- ##
=========================================
Coverage ? 69.09%
=========================================
Files ? 82
Lines ? 8960
Branches ? 0
=========================================
Hits ? 6191
Misses ? 2021
Partials ? 748
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! This will save us a lot of time on keeping updating the signatures and addresses.
Some minor comments
blockchain/genesis.go
Outdated
Recipient string `yaml:"recipient"` | ||
Signature string `yaml:"signature"` | ||
Amount int64 `yaml:"amount"` | ||
RecipientPub string `yaml:"recipientPub"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RecipientPub -> RecipientPK?
blockchain/genesis.go
Outdated
} | ||
|
||
// DecodeKey decodes the string keypair | ||
func decodeKey(pubK string, priK string) (pk keypair.PublicKey, sk keypair.PrivateKey) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually we put private methods (with lowerCamelCase) after public method
blockchain/genesis.go
Outdated
return | ||
} | ||
|
||
// GenerateAddr returns the string address according to public key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
method name doesn't match the comment
blockchain/genesis.go
Outdated
CreatorPrivKey: "d2df3528ff384d41cc9688c354cd301a09f91d95582eb8034a6eff140e7539cb17b53401", | ||
} | ||
|
||
// DecodeKey decodes the string keypair |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method name doesn't match the comment (case)
pk, sk := decodeKey(nominator.PubKey, nominator.PriKey) | ||
address := generateAddr(cfg.Chain.ID, pk) | ||
vote, err := action.NewVote( | ||
0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lizhefeng, would you please comment if 0 nonce is correct or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is correct. Meant to be 0.
tsf, err := action.NewTransfer( | ||
0, big.NewInt(transfer.Amount), Gen.CreatorAddr(cfg.Chain.ID), transfer.Recipient, []byte{}, 0, big.NewInt(0)) | ||
0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lizhefeng same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is correct. Meant to be 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have refactored the code
@MrAngelll congrats on the first PR. Looking forward to more contributions |
No description provided.