public static DeterministicKey deriveThisOrNextChildKey ( DeterministicKey parent , int childNumber ) { int nAttempts = 0 ; ChildNumber child = new ChildNumber ( childNumber ) ; boolean isHardened = child . isHardened ( ) ; while ( nAttempts < MAX_CHILD_DERIVATION_ATTEMPTS ) { try { child = new ChildNumber ( child . num ( ) + nAttempts , isHardened ) ; return deriveChildKey ( parent , child ) ; } catch ( HDDerivationException ignore ) { } nAttempts ++ ; } throw new 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 .