HDWallet: add fromBase58 exception checks
This commit is contained in:
parent
cde285ccfc
commit
80da2ed2d5
3 changed files with 28 additions and 3 deletions
src
|
@ -49,8 +49,8 @@ HDWallet.fromBase58 = function(string) {
|
|||
var checksum = buffer.slice(-4)
|
||||
var newChecksum = crypto.hash256(payload).slice(0, 4)
|
||||
|
||||
assert.deepEqual(newChecksum, checksum)
|
||||
assert.equal(payload.length, HDWallet.LENGTH)
|
||||
assert.deepEqual(newChecksum, checksum, 'Invalid checksum')
|
||||
assert.equal(payload.length, HDWallet.LENGTH, 'Invalid BIP32 string')
|
||||
|
||||
return HDWallet.fromBuffer(payload)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue