-
Notifications
You must be signed in to change notification settings - Fork 152
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
Sanity check in PrivateKey constructor using bytes #438
Conversation
Codecov Report
@@ Coverage Diff @@
## master #438 +/- ##
==========================================
- Coverage 87.94% 87.92% -0.03%
==========================================
Files 198 198
Lines 14426 14439 +13
==========================================
+ Hits 12687 12695 +8
- Misses 1425 1429 +4
- Partials 314 315 +1
|
Co-Authored-By: Seunghun Lee <[email protected]>
CHANGES.md
Outdated
@@ -82,6 +82,7 @@ To be released. | |||
the `Transaction<T>` more than once. [[#413]] | |||
- `BlockChain<T>.Swap()` became to omit common block finding when `render` is | |||
`false`. [[#423]] | |||
- `PrivateKey(bytes)` became to valid check. [[#438]] |
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.
- `PrivateKey(bytes)` became to valid check. [[#438]] | |
- `PrivateKey(byte[])` constructor became to check validity. [[#438]] |
Libplanet/Crypto/PrivateKey.cs
Outdated
} | ||
catch (ArgumentException) | ||
{ | ||
throw new InvalidOperationException( |
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 believe ArgumentException
would be more suitable here.
throw new InvalidOperationException( | |
throw new ArgumentException( |
Libplanet/Crypto/PrivateKey.cs
Outdated
); | ||
|
||
var key = new PrivateKey(param); | ||
var publicKey = key.PublicKey; |
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 statement also seems unnatural, so it would be better if there is some comment about it.
Libplanet/Crypto/PrivateKey.cs
Outdated
); | ||
|
||
var key = new PrivateKey(param); | ||
var publicKey = key.PublicKey; |
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.
var publicKey = key.PublicKey; | |
var _ = key.PublicKey; |
resolved #358