HDNode: simplify path derivation
This commit is contained in:
parent
1247061d05
commit
0b3a042ca2
1 changed files with 6 additions and 11 deletions
|
@ -274,13 +274,11 @@ describe('HDNode', function () {
|
||||||
it(c.description + ' from ' + f.master.fingerprint + ' by path', function () {
|
it(c.description + ' from ' + f.master.fingerprint + ' by path', function () {
|
||||||
var path = c.description
|
var path = c.description
|
||||||
var child = master.derivePath(path)
|
var child = master.derivePath(path)
|
||||||
|
var pathNoM = path.slice(2)
|
||||||
var pathSplit = path.split('/').slice(1)
|
var childNoM = master.derivePath(pathNoM)
|
||||||
var pathNoM = pathSplit.join('/')
|
|
||||||
var childNotM = master.derivePath(pathNoM)
|
|
||||||
|
|
||||||
verifyVector(child, c)
|
verifyVector(child, c)
|
||||||
verifyVector(childNotM, c)
|
verifyVector(childNoM, c)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -291,15 +289,12 @@ describe('HDNode', function () {
|
||||||
f.children.slice(i + 1).forEach(function (cc) {
|
f.children.slice(i + 1).forEach(function (cc) {
|
||||||
it(cc.description + ' from ' + c.fingerprint + ' by path', function () {
|
it(cc.description + ' from ' + c.fingerprint + ' by path', function () {
|
||||||
var path = cc.description
|
var path = cc.description
|
||||||
|
var iPath = path.slice(2).split('/').slice(i + 1).join('/')
|
||||||
var pathSplit = path.split('/').slice(i + 2)
|
var child = cn.derivePath(iPath)
|
||||||
var pathEnd = pathSplit.join('/')
|
|
||||||
var pathEndM = 'm/' + pathEnd
|
|
||||||
var child = cn.derivePath(pathEnd)
|
|
||||||
verifyVector(child, cc)
|
verifyVector(child, cc)
|
||||||
|
|
||||||
assert.throws(function () {
|
assert.throws(function () {
|
||||||
cn.derivePath(pathEndM)
|
cn.derivePath('m/' + iPath)
|
||||||
}, /Not a master node/)
|
}, /Not a master node/)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue