Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,12 @@ export default class IndexerCacheService {
continue
}

for (const { lockHash, address } of mappings) {
for (const { lockHash } of mappings) {
indexerCaches.push(
IndexerTxHashCache.fromObject({
txHash: transaction.hash!,
blockNumber: parseInt(transaction.blockNumber!),
lockHash,
address,
walletId: this.walletId,
})
)
Expand Down Expand Up @@ -267,7 +266,6 @@ export default class IndexerCacheService {
txHash: v.txHash,
blockNumber: parseInt(v.blockNumber!),
lockHash: v.lockHash,
address: v.address,
walletId: v.walletId,
})
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ export default class IndexerTxHashCache extends BaseEntity {
@Index()
lockHash!: string

@Column({
type: 'character',
length: 32,
})
@Index()
address!: string

@Column({
type: 'character',
length: 32,
Expand Down Expand Up @@ -54,12 +47,11 @@ export default class IndexerTxHashCache extends BaseEntity {
})
updatedAt!: Date

static fromObject(obj: { txHash: string; blockNumber: number; lockHash: string; address: string; walletId: string }) {
static fromObject(obj: { txHash: string; blockNumber: number; lockHash: string; walletId: string }) {
const result = new IndexerTxHashCache()
result.txHash = obj.txHash
result.blockNumber = obj.blockNumber
result.lockHash = obj.lockHash
result.address = obj.address
result.walletId = obj.walletId
result.isProcessed = false
return result
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {MigrationInterface, QueryRunner, TableColumn} from "typeorm";

export class RemoveAddressInIndexerCache1704357651876 implements MigrationInterface {

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropColumn('indexer_tx_hash_cache', 'address')
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.addColumn('indexer_tx_hash_cache', new TableColumn({
name: 'address',
type: 'character(32)',
isNullable: false,
}))
}

}
2 changes: 2 additions & 0 deletions packages/neuron-wallet/src/database/chain/ormconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import { TxLockAddArgs1694746034975 } from './migrations/1694746034975-TxLockAdd
import { IndexerTxHashCacheRemoveField1701234043431 } from './migrations/1701234043431-IndexerTxHashCacheRemoveField'
import { CreateCellLocalInfo1701234043432 } from './migrations/1701234043432-CreateCellLocalInfo'
import { RenameSyncProgress1702781527414 } from './migrations/1702781527414-RenameSyncProgress'
import { RemoveAddressInIndexerCache1704357651876 } from './migrations/1704357651876-RemoveAddressInIndexerCache'

export const CONNECTION_NOT_FOUND_NAME = 'ConnectionNotFoundError'

Expand Down Expand Up @@ -134,6 +135,7 @@ const connectOptions = async (genesisBlockHash: string): Promise<SqliteConnectio
IndexerTxHashCacheRemoveField1701234043431,
CreateCellLocalInfo1701234043432,
RenameSyncProgress1702781527414,
RemoveAddressInIndexerCache1704357651876,
],
logger: 'simple-console',
logging,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ describe('unit tests for IndexerConnector', () => {
txHash: 'hash1',
blockNumber: 10,
lockHash: script.computeHash(),
address,
walletId,
}),
]
Expand All @@ -165,7 +164,6 @@ describe('unit tests for IndexerConnector', () => {
txHash: 'hash2',
blockNumber: 2,
lockHash: script.computeHash(),
address,
walletId,
}),
]
Expand Down