mirror of
https://github.com/mempool/mempool.git
synced 2025-01-01 03:04:27 +01:00
Merge pull request #1291 from mempool/simon/address-prefix-bug
Only return unique address prefix autocomplete
This commit is contained in:
commit
5ac2c1cf34
@ -84,19 +84,19 @@ class BitcoinApi implements AbstractBitcoinApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$getAddressPrefix(prefix: string): string[] {
|
$getAddressPrefix(prefix: string): string[] {
|
||||||
const found: string[] = [];
|
const found: { [address: string]: string } = {};
|
||||||
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.push(vout.scriptpubkey_address);
|
found[vout.scriptpubkey_address] = '';
|
||||||
if (found.length >= 10) {
|
if (Object.keys(found).length >= 10) {
|
||||||
return found;
|
return Object.keys(found);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return found;
|
return Object.keys(found);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sendRawTransaction(rawTransaction: string): Promise<string> {
|
$sendRawTransaction(rawTransaction: string): Promise<string> {
|
||||||
|
Loading…
Reference in New Issue
Block a user