Merge pull request #5206 from mempool/simon/address-prefix-fixes
Fix address prefix for non esplora backend
This commit is contained in:
commit
4fbdf92f0c
@ -165,13 +165,21 @@ class BitcoinApi implements AbstractBitcoinApi {
|
|||||||
const mp = mempool.getMempool();
|
const mp = mempool.getMempool();
|
||||||
for (const tx in mp) {
|
for (const tx in mp) {
|
||||||
for (const vout of mp[tx].vout) {
|
for (const vout of mp[tx].vout) {
|
||||||
if (vout.scriptpubkey_address.indexOf(prefix) === 0) {
|
if (vout.scriptpubkey_address?.indexOf(prefix) === 0) {
|
||||||
found[vout.scriptpubkey_address] = '';
|
found[vout.scriptpubkey_address] = '';
|
||||||
if (Object.keys(found).length >= 10) {
|
if (Object.keys(found).length >= 10) {
|
||||||
return Object.keys(found);
|
return Object.keys(found);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (const vin of mp[tx].vin) {
|
||||||
|
if (vin.prevout?.scriptpubkey_address?.indexOf(prefix) === 0) {
|
||||||
|
found[vin.prevout?.scriptpubkey_address] = '';
|
||||||
|
if (Object.keys(found).length >= 10) {
|
||||||
|
return Object.keys(found);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Object.keys(found);
|
return Object.keys(found);
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ export namespace IEsploraApi {
|
|||||||
scriptpubkey: string;
|
scriptpubkey: string;
|
||||||
scriptpubkey_asm: string;
|
scriptpubkey_asm: string;
|
||||||
scriptpubkey_type: string;
|
scriptpubkey_type: string;
|
||||||
scriptpubkey_address: string;
|
scriptpubkey_address?: string;
|
||||||
value: number;
|
value: number;
|
||||||
// Elements
|
// Elements
|
||||||
valuecommitment?: number;
|
valuecommitment?: number;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user