@@ -233,11 +233,9 @@ var DashHd = ("object" === typeof module && exports) || {};
233
233
hdkey . getPrivateKey = function ( ) {
234
234
return _privateKey ;
235
235
} ;
236
- hdkey . setPrivateKey = async function ( privBytes ) {
237
- assert ( privBytes . length === 32 , "Private key must be 32 bytes." ) ;
238
-
236
+ hdkey . setPrivateKey = function ( privBytes ) {
239
237
_privateKey = privBytes ;
240
- hdkey . publicKey = await Utils . toPublicKey ( _privateKey ) ;
238
+ return null ;
241
239
} ;
242
240
243
241
hdkey . getPrivateExtendedKey = async function ( ) {
@@ -345,7 +343,8 @@ var DashHd = ("object" === typeof module && exports) || {};
345
343
346
344
if ( _privateKey ) {
347
345
let nextPrivKey = await Utils . privateKeyTweakAdd ( _privateKey , IL ) ;
348
- await _hdkey . setPrivateKey ( nextPrivKey ) ;
346
+ _hdkey . setPrivateKey ( nextPrivKey ) ;
347
+ _hdkey . publicKey = await Utils . toPublicKey ( nextPrivKey ) ;
349
348
} else {
350
349
_hdkey . publicKey = await Utils . publicKeyTweakAdd ( hdkey . publicKey , IL ) ;
351
350
}
@@ -402,6 +401,7 @@ var DashHd = ("object" === typeof module && exports) || {};
402
401
let hdkey = DashHd . create ( versions ) ;
403
402
hdkey . chainCode = IR ;
404
403
await hdkey . setPrivateKey ( IL ) ;
404
+ hdkey . publicKey = await Utils . toPublicKey ( IL ) ;
405
405
406
406
return hdkey ;
407
407
} ;
@@ -442,7 +442,9 @@ var DashHd = ("object" === typeof module && exports) || {};
442
442
version === versions . private ,
443
443
"Version mismatch: version does not match private" ,
444
444
) ;
445
- await hdkey . setPrivateKey ( key . subarray ( 1 ) ) ; // cut off first 0x0 byte
445
+ let privBytes = key . subarray ( 1 ) ; // cut off first 0x0 byte
446
+ await hdkey . setPrivateKey ( privBytes ) ;
447
+ hdkey . publicKey = await Utils . toPublicKey ( privBytes ) ;
446
448
} else {
447
449
assert (
448
450
version === versions . public ,
0 commit comments