remove unnecessary filtering code
This commit is contained in:
parent
a53bd10f42
commit
e07186df07
@ -158,17 +158,10 @@ PrivateKey._transformBuffer = function(buf, network) {
|
|||||||
|
|
||||||
info.network = Networks.get(buf[0], 'privatekey');
|
info.network = Networks.get(buf[0], 'privatekey');
|
||||||
|
|
||||||
var allNetworks = Networks.all();
|
if (!info.network) {
|
||||||
var matches = _.filter( allNetworks, function( network) {
|
|
||||||
return buf[0] === network.privatekey;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (matches.length !== 1) {
|
|
||||||
throw new Error('Invalid network');
|
throw new Error('Invalid network');
|
||||||
}
|
}
|
||||||
|
|
||||||
info.network = matches[0];
|
|
||||||
|
|
||||||
if (network && info.network !== Networks.get(network)) {
|
if (network && info.network !== Networks.get(network)) {
|
||||||
throw new TypeError('Private key network mismatch');
|
throw new TypeError('Private key network mismatch');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user