HDWallet: remove repeated assertion

This commit is contained in:
Daniel Cousens 2014-05-31 20:17:41 +10:00
parent c0006c299f
commit 759aeb9abc
2 changed files with 3 additions and 4 deletions

View file

@ -55,10 +55,9 @@ HDWallet.fromBase58 = function(string) {
var payload = buffer.slice(0, -4) var payload = buffer.slice(0, -4)
var checksum = buffer.slice(-4) var checksum = buffer.slice(-4)
var newChecksum = crypto.hash256(payload).slice(0, 4)
var newChecksum = crypto.hash256(payload).slice(0, 4)
assert.deepEqual(newChecksum, checksum, 'Invalid checksum') assert.deepEqual(newChecksum, checksum, 'Invalid checksum')
assert.equal(payload.length, HDWallet.LENGTH, 'Invalid BIP32 string')
return HDWallet.fromBuffer(payload) return HDWallet.fromBuffer(payload)
} }

View file

@ -183,11 +183,11 @@
"string": "xprvQQQQQQQQQQQQQQQQCviVfJSKyQ1mDYahRjijr5idH2WwLsEd4Hsb2Tyh8RfQMuPh7f7RtyzTtdrbdqqsunu5Mm3wDvUAKRHSC34sJ7in334" "string": "xprvQQQQQQQQQQQQQQQQCviVfJSKyQ1mDYahRjijr5idH2WwLsEd4Hsb2Tyh8RfQMuPh7f7RtyzTtdrbdqqsunu5Mm3wDvUAKRHSC34sJ7in334"
}, },
{ {
"exception": "Invalid BIP32 string", "exception": "Invalid buffer length",
"string": "SQ8nQ2jWarXqLo9oHGKKP6iQDsQbPRftq7rjtYY3hqJRPQRgrmeunFnDKbH7B15yGPLZBrhhkKXx3pwD6LcBooJRGq6x7matAXpMsgn" "string": "SQ8nQ2jWarXqLo9oHGKKP6iQDsQbPRftq7rjtYY3hqJRPQRgrmeunFnDKbH7B15yGPLZBrhhkKXx3pwD6LcBooJRGq6x7matAXpMsgn"
}, },
{ {
"exception": "Invalid BIP32 string", "exception": "Invalid buffer length",
"string": "37hdAfw3aMiWcBGPP2ywmY5jizTeSSP5GXayKY3RxkEZ7f3SBnRE1pN6eY3VzGkgx6vbdNtuKfrHgEaYvW9KkFZCycaPvWiA9TtfmeVB592Sf9RfSzQzXo72" "string": "37hdAfw3aMiWcBGPP2ywmY5jizTeSSP5GXayKY3RxkEZ7f3SBnRE1pN6eY3VzGkgx6vbdNtuKfrHgEaYvW9KkFZCycaPvWiA9TtfmeVB592Sf9RfSzQzXo72"
} }
], ],