diff --git a/lib/pool.js b/lib/pool.js index bba0454d7..93366d280 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -44,6 +44,8 @@ var shareTrustMinFloat = shareTrustEnabled ? config.poolServer.shareTrust.min / var banningEnabled = config.poolServer.banning && config.poolServer.banning.enabled; +var addressBase58Prefix = cnUtil.address_decode(new Buffer(config.poolServer.poolAddress)); + setInterval(function(){ var now = Date.now() / 1000 | 0; @@ -440,7 +442,7 @@ function handleMinerMethod(method, params, ip, portData, sendReply, pushMessage) sendReply('missing login'); return; } - if (!utils.isValidAddress(params.login, config.poolServer.poolAddress[0])){ + if (addressBase58Prefix !== cnUtil.address_decode(new Buffer(params.login))) { sendReply('invalid address used for login'); return; } diff --git a/lib/utils.js b/lib/utils.js index bcbdb0cae..f793fd1fc 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -46,17 +46,3 @@ exports.ringBuffer = function(maxSize){ exports.varIntEncode = function(n){ }; - -exports.isValidAddress = function(addr, prefix){ - - if (addr.length !== 95) return false; - if (addr[0] !== prefix) return false; - try{ - var decoded = cnUtil.address_decode(new Buffer(addr)); - return decoded.length > 0; - } - catch(e){ - return false; - } - -};