fun deriveThisOrNextChildKey(parent: DeterministicKey?, childNumber: Int): DeterministicKey? { var nAttempts = 0 var child = ChildNumber(childNumber) val isHardened: Boolean = child.isHardened() while (nAttempts < MAX_CHILD_DERIVATION_ATTEMPTS) { try { child = ChildNumber(child.num() + nAttempts, isHardened) return deriveChildKey(parent, child) } catch (ignore: HDDerivationException) { } nAttempts++ } throw HDDerivationException("Maximum number of child derivation attempts reached, this is probably an indication of a bug.") }
Derives a key of the `` extended '' child number , ie . with the 0x80000000 bit specifying whether to use hardened derivation or not . If derivation fails , tries a next child .