HDWallet: add fromBase58 exception checks

This commit is contained in:
Daniel Cousens 2014-05-30 19:00:49 +10:00
parent cde285ccfc
commit 80da2ed2d5
3 changed files with 28 additions and 3 deletions

View file

@ -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)
}