HDNode/tests: add testing for invalid network version from networks list
This commit is contained in:
parent
9e32c892ef
commit
bdb0dd4a17
3 changed files with 9 additions and 6 deletions
src
|
@ -64,7 +64,9 @@ HDNode.fromBase58 = function (string, networks) {
|
|||
network = networks.filter(function (network) {
|
||||
return version === network.bip32.private ||
|
||||
version === network.bip32.public
|
||||
}).pop() || {}
|
||||
}).pop()
|
||||
|
||||
if (!network) throw new Error('Invalid network version')
|
||||
|
||||
// otherwise, assume a network object (or default to bitcoin)
|
||||
} else {
|
||||
|
@ -72,7 +74,7 @@ HDNode.fromBase58 = function (string, networks) {
|
|||
}
|
||||
|
||||
if (version !== network.bip32.private &&
|
||||
version !== network.bip32.public) throw new Error('Invalid network')
|
||||
version !== network.bip32.public) throw new Error('Invalid network version')
|
||||
|
||||
// 1 byte: depth: 0x00 for master nodes, 0x01 for level-1 descendants, ...
|
||||
var depth = buffer[4]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue