mirror of
https://github.com/mempool/mempool.git
synced 2025-02-24 06:47:52 +01:00
Add check for pool addresses and regexes
This commit is contained in:
parent
e2080e5548
commit
35215c7740
1 changed files with 22 additions and 0 deletions
|
@ -52,6 +52,28 @@ class PoolsParser {
|
|||
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);
|
||||
if (!poolDB) {
|
||||
// New mining pool
|
||||
|
|
Loading…
Add table
Reference in a new issue