Merge pull request #5098 from mempool/natsoni/add-pool-health-check
Add check for pool addresses and regexes
This commit is contained in:
commit
a53b587395
@ -52,6 +52,28 @@ class PoolsParser {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// One of the two fields 'addresses' or 'regexes' must be a non-empty array
|
||||||
|
if (!pool.addresses && !pool.regexes) {
|
||||||
|
logger.err(`Mining pool ${pool.name} must have at least one of the fields 'addresses' or 'regexes'. Skipping.`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
pool.addresses = pool.addresses || [];
|
||||||
|
pool.regexes = pool.regexes || [];
|
||||||
|
|
||||||
|
if (pool.addresses.length === 0 && pool.regexes.length === 0) {
|
||||||
|
logger.err(`Mining pool ${pool.name} has no 'addresses' nor 'regexes' defined. Skipping.`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pool.addresses.length === 0) {
|
||||||
|
logger.warn(`Mining pool ${pool.name} has no 'addresses' defined.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pool.regexes.length === 0) {
|
||||||
|
logger.warn(`Mining pool ${pool.name} has no 'regexes' defined.`);
|
||||||
|
}
|
||||||
|
|
||||||
const poolDB = await PoolsRepository.$getPoolByUniqueId(pool.id, false);
|
const poolDB = await PoolsRepository.$getPoolByUniqueId(pool.id, false);
|
||||||
if (!poolDB) {
|
if (!poolDB) {
|
||||||
// New mining pool
|
// New mining pool
|
||||||
|
Loading…
x
Reference in New Issue
Block a user