-
Notifications
You must be signed in to change notification settings - Fork 2.2k
HDWallet tests and strict constructor #203
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
Conversation
|
The coveralls statistics are off because the last PR caused coveralls to think half the codebase was deleted (no idea why...) |
Also adds network parameter for later moving the network specific tests to be data driven.
|
There are tests missing for extended public key derivation; I'll be adding
|
|
I still haven't found the best way to neuter a |
|
Good to go. @weilu @abrkn @kyledrake |
Only a problem if "use strict" is enforced
|
The failed build is just helloblock's API dying again... @sidazhang could you look into this? It's getting a bit frustrating. We at least could use some kind of error message if it is our fault. @locksley |
|
@dcousens How often does this happen? https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/p2sh.js#L13 Could you add |
|
If error was an object, does mocha print the content of the object? https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/p2sh.js#L37 |
|
@sidazhang I have found it rarely happens locally. It seems to be an async problem with the way the test is structured right now. If one request fails before another, it throws all requests thereafter. |
|
It appears that mocha does not print the contents of the object. |
|
Right. But if one request fails, shouldn't the test just stops? |
|
Yes, I was just explaining in terms of a local test I have, where I was continuing despite the error. |
HDWallet tests and strict constructor
This pull request finally restricts the
HDWalletconstructor to a restrictive form that only accepts two prototypes (unfortunately not 1):HDWallet :: BigInteger -> Buffer -> Network, privateHDWallet :: ECPointFp -> Buffer -> Network, publicIt adds tests for these constructors, all the implied behaviour and overall adds tests for all the methods within
HDWallet, includinggetFingerprint,getIdentifier,getAddressandfromSeed*.Some of these features were tested in the
HDWallettest vectors, but now these tests have been separated to better identify functionality, while still maintaining the same level of test coverage (if not more).HDWallet.getKeyVersionwas removed, it was returning thepubKeyHashand has no meaningful representation in the specification, so I saw no need to keep it.I can't decide whether keeping
from/toBuffer(and their*Hexwrappers) is a worthwhile decision, as I see no use case for it. The purpose of the Base58 export functions is that they have error checking and are human readable.