Skip to content

Commit caa02f7

Browse files
committed
don't upsert addresses
1 parent f431409 commit caa02f7

1 file changed

Lines changed: 1 addition & 17 deletions

File tree

services/chronikService.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
import { Address, Prisma, ClientPaymentStatus } from '@prisma/client'
2121
import xecaddr from 'xecaddrjs'
2222
import { getAddressPrefix, satoshisToUnit } from 'utils/index'
23-
import { fetchAddressesArray, fetchAllAddressesForNetworkId, getEarliestUnconfirmedTxTimestampForAddress, getLatestConfirmedTxTimestampForAddress, setSyncing, setSyncingBatch, updateLastSynced, updateManyLastSynced, upsertAddress } from './addressService'
23+
import { fetchAddressesArray, fetchAllAddressesForNetworkId, getEarliestUnconfirmedTxTimestampForAddress, getLatestConfirmedTxTimestampForAddress, setSyncing, setSyncingBatch, updateLastSynced, updateManyLastSynced } from './addressService'
2424
import * as ws from 'ws'
2525
import { BroadcastTxData } from 'ws-service/types'
2626
import config from 'config'
@@ -287,23 +287,7 @@ export class ChronikBlockchainClient {
287287
const { amount, opReturn } = await this.getTransactionAmountAndData(transaction, address.address)
288288
const inputAddresses = this.getSortedInputAddresses(transaction)
289289
const outputAddresses = this.getSortedOutputAddresses(transaction)
290-
291-
const uniqueAddressStrings = [...new Set([
292-
...inputAddresses.map(({ address: addr }) => addr),
293-
...outputAddresses.map(({ address: addr }) => addr)
294-
])]
295290
const addressIdMap = new Map<string, string>()
296-
await Promise.all(
297-
uniqueAddressStrings.map(async (addrStr) => {
298-
try {
299-
const parsed = parseAddress(addrStr)
300-
const addr = await upsertAddress(parsed)
301-
addressIdMap.set(parsed, addr.id)
302-
} catch {
303-
// Skip invalid addresses: don't upsert, don't add to map
304-
}
305-
})
306-
)
307291

308292
const getAddressId = (addr: string): string | undefined => {
309293
try {

0 commit comments

Comments
 (0)