Merge pull request #792 from braydonf/bug/private-key-version-test
Private Key: Fix bug with tests and missing "new"
This commit is contained in:
commit
aa2ae53392
@ -157,7 +157,7 @@ PrivateKey._transformBuffer = function(buf, network) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (network && info.network !== Networks.get(network)) {
|
if (network && info.network !== Networks.get(network)) {
|
||||||
throw TypeError('Private key network mismatch');
|
throw new TypeError('Private key network mismatch');
|
||||||
}
|
}
|
||||||
|
|
||||||
info.bn = BN.fromBuffer(buf.slice(1, 32 + 1));
|
info.bn = BN.fromBuffer(buf.slice(1, 32 + 1));
|
||||||
|
|||||||
@ -90,7 +90,7 @@ describe('PrivateKey', function() {
|
|||||||
it('should not be able to instantiate private key WIF because of unknown network byte', function() {
|
it('should not be able to instantiate private key WIF because of unknown network byte', function() {
|
||||||
expect(function() {
|
expect(function() {
|
||||||
var buf = base58check.decode('L3T1s1TYP9oyhHpXgkyLoJFGniEgkv2Jhi138d7R2yJ9F4QdDU2m');
|
var buf = base58check.decode('L3T1s1TYP9oyhHpXgkyLoJFGniEgkv2Jhi138d7R2yJ9F4QdDU2m');
|
||||||
var buf2 = Buffer.concat([new Buffer(0x01, 'hex'), buf.slice(1, 33)]);
|
var buf2 = Buffer.concat([new Buffer('ff', 'hex'), buf.slice(1, 33)]);
|
||||||
var a = new PrivateKey(buf2);
|
var a = new PrivateKey(buf2);
|
||||||
}).to.throw('Invalid network');
|
}).to.throw('Invalid network');
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user