From 31ea2e1d4bef21d4aa037599e4a81b80c0444ffe Mon Sep 17 00:00:00 2001 From: softsimon Date: Wed, 24 May 2023 01:22:01 +0400 Subject: [PATCH] Fix for pool output address matching fixes #3782 --- backend/src/api/blocks.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/backend/src/api/blocks.ts b/backend/src/api/blocks.ts index 23814a87e..bce7983d3 100644 --- a/backend/src/api/blocks.ts +++ b/backend/src/api/blocks.ts @@ -306,7 +306,7 @@ class Blocks { } 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[] = []; if (config.DATABASE.ENABLED === true) { @@ -316,11 +316,13 @@ class Blocks { } for (let i = 0; i < pools.length; ++i) { - if (address !== undefined) { - const addresses: string[] = typeof pools[i].addresses === 'string' ? + if (addresses.length) { + const poolAddresses: string[] = typeof pools[i].addresses === 'string' ? JSON.parse(pools[i].addresses) : pools[i].addresses; - if (addresses.indexOf(address) !== -1) { - return pools[i]; + for (let y = 0; y < poolAddresses.length; y++) { + if (addresses.indexOf(poolAddresses[y]) !== -1) { + return pools[i]; + } } }