Fix for pool output address matching

fixes #3782
This commit is contained in:
softsimon 2023-05-24 01:22:01 +04:00
parent c81509d762
commit 31ea2e1d4b
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7

View File

@ -306,7 +306,7 @@ class Blocks {
} }
const asciiScriptSig = transactionUtils.hex2ascii(txMinerInfo.vin[0].scriptsig); const asciiScriptSig = transactionUtils.hex2ascii(txMinerInfo.vin[0].scriptsig);
const address = txMinerInfo.vout[0].scriptpubkey_address; const addresses = txMinerInfo.vout.map((vout) => vout.scriptpubkey_address).filter((address) => address);
let pools: PoolTag[] = []; let pools: PoolTag[] = [];
if (config.DATABASE.ENABLED === true) { if (config.DATABASE.ENABLED === true) {
@ -316,13 +316,15 @@ class Blocks {
} }
for (let i = 0; i < pools.length; ++i) { for (let i = 0; i < pools.length; ++i) {
if (address !== undefined) { if (addresses.length) {
const addresses: string[] = typeof pools[i].addresses === 'string' ? const poolAddresses: string[] = typeof pools[i].addresses === 'string' ?
JSON.parse(pools[i].addresses) : pools[i].addresses; JSON.parse(pools[i].addresses) : pools[i].addresses;
if (addresses.indexOf(address) !== -1) { for (let y = 0; y < poolAddresses.length; y++) {
if (addresses.indexOf(poolAddresses[y]) !== -1) {
return pools[i]; return pools[i];
} }
} }
}
const regexes: string[] = typeof pools[i].regexes === 'string' ? const regexes: string[] = typeof pools[i].regexes === 'string' ?
JSON.parse(pools[i].regexes) : pools[i].regexes; JSON.parse(pools[i].regexes) : pools[i].regexes;