File tree Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change @@ -40,8 +40,8 @@ export interface Versions {
40
40
const hash160 = ( data : Uint8Array ) => ripemd160 ( sha256 ( data ) ) ;
41
41
const fromU32 = ( data : Uint8Array ) => createView ( data ) . getUint32 ( 0 , false ) ;
42
42
const toU32 = ( n : number ) => {
43
- if ( ! Number . isSafeInteger ( n ) || n < 0 || n >= 2 ** 32 ) {
44
- throw new Error ( `Invalid number=${ n } . Should be [0, 2**32) ` ) ;
43
+ if ( ! Number . isSafeInteger ( n ) || n < 0 || n > 2 ** 32 - 1 ) {
44
+ throw new Error ( `Invalid number=${ n } . Should be from 1 to 2 ** 32 - 1 ` ) ;
45
45
}
46
46
const buf = new Uint8Array ( 4 ) ;
47
47
createView ( buf ) . setUint32 ( 0 , n , false ) ;
@@ -219,11 +219,6 @@ export class HDKey {
219
219
}
220
220
221
221
public deriveChild ( index : number ) : HDKey {
222
- if ( ! Number . isSafeInteger ( index ) || index < 0 || index >= 2 ** 32 ) {
223
- throw new Error (
224
- `Child index should be positive 32-bit integer, not ${ index } `
225
- ) ;
226
- }
227
222
if ( ! this . pubKey || ! this . chainCode ) {
228
223
throw new Error ( "No publicKey or chainCode set" ) ;
229
224
}
You can’t perform that action at this time.
0 commit comments