Miner address validation based on pool address
parent
57f94fb058
commit
a9d48795c9
|
@ -18,7 +18,6 @@
|
|||
"enabled": true,
|
||||
"clusterForks": "auto",
|
||||
"poolAddress": "48Y4SoUJM5L3YXBEfNQ8bFNsvTNsqcH5Rgq8RF7BwpgvTBj2xr7CmWVanaw7L4U9MnZ4AG7U6Pn1pBhfQhFyFZ1rL1efL8z",
|
||||
"addressBase58Prefix": 18,
|
||||
"blockRefreshInterval": 1000,
|
||||
"minerTimeout": 900,
|
||||
"ports": [
|
||||
|
|
|
@ -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(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.addressBase58Prefix)){
|
||||
if (addressBase58Prefix !== cnUtil.address_decode(params.login)){
|
||||
sendReply('invalid address used for login');
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -46,12 +46,3 @@ exports.ringBuffer = function(maxSize){
|
|||
exports.varIntEncode = function(n){
|
||||
|
||||
};
|
||||
|
||||
exports.isValidAddress = function(addr, prefix){
|
||||
try{
|
||||
return cnUtil.check_address(new Buffer(addr), prefix);
|
||||
}
|
||||
catch(e){
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue