http: allow hash/height mixup.

This commit is contained in:
Christopher Jeffrey 2016-11-16 10:03:03 -08:00
parent f6c09af49f
commit 51e271fe0d
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -245,7 +245,9 @@ HTTPServer.prototype._init = function _init() {
options.id = params.id;
}
if (params.hash) {
if (utils.isUInt32(params.hash)) {
options.height = params.hash;
} else if (params.hash) {
enforce(typeof params.hash === 'string', 'Hash must be a string.');
if (params.hash.length !== 64) {
options.height = Number(params.hash);