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
2 changes: 1 addition & 1 deletion packages/neuron-ui/src/components/NetworkStatus/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const NetworkStatus = ({
) : null}
{isMigrate && <div className={styles.tooltip}>{t('network-status.migrating')}</div>}
{network ? (
<div>
<div className={styles.networkDisplay}>
<NetworkTypeLabel type={network.chain} />
<span className={styles.name}>{network.name}</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ $hover-bg-color: #3cc68a4d;
font-size: 0.8rem;
font-weight: bold;

.name {
position: relative;
display: flex;
align-items: center;
line-height: 1em;
word-break: break-all;
margin-top: 3px;
.networkDisplay {
max-width: 100%;

.name {
position: relative;
display: block;
line-height: 16px;
word-break: break-all;
overflow-wrap: break-word;
margin-top: 3px;
}
}

/* keep the tooltip popped to make it more obvious */
Expand Down
5 changes: 3 additions & 2 deletions packages/neuron-wallet/src/database/chain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@ import TransactionEntity from './entities/transaction'
import SyncInfoEntity from './entities/sync-info'
import IndexerTxHashCache from './entities/indexer-tx-hash-cache'
import MultisigOutput from './entities/multisig-output'
import SyncProgress from './entities/sync-progress'

/*
* Clean local sqlite storage
*/
export const clean = async () => {
export const clean = async (clearAllLightClientData?: boolean) => {
await Promise.all([
...[InputEntity, OutputEntity, TransactionEntity, IndexerTxHashCache, MultisigOutput].map(entity => {
return getConnection()
.getRepository(entity)
.clear()
}),
SyncProgressService.clearCurrentWalletProgress()
clearAllLightClientData ? getConnection().getRepository(SyncProgress).clear() : SyncProgressService.clearCurrentWalletProgress()
])
MultisigOutputChangedSubject.getSubject().next('reset')

Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-wallet/src/services/light-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export class CKBLightRunner extends NodeRunner {
async clearNodeCache(): Promise<void> {
await this.stop()
fs.rmSync(SettingsService.getInstance().testnetLightDataPath, { recursive: true, force: true })
await clean()
await clean(true)
await this.start()
resetSyncTaskQueue.asyncPush(true)
}
Expand Down
8 changes: 7 additions & 1 deletion packages/neuron-wallet/src/services/sync-progress.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getConnection, In, Not } from 'typeorm'
import { Equal, getConnection, In, Not } from 'typeorm'
import { scriptToHash } from '@nervosnetwork/ckb-sdk-utils'
import { HexString } from '@ckb-lumos/base'
import SyncProgress, { SyncAddressType } from '../database/chain/entities/sync-progress'
Expand Down Expand Up @@ -129,5 +129,11 @@ export default class SyncProgressService {
await getConnection()
.getRepository(SyncProgress)
.delete({ walletId: currentWallet?.id })
await getConnection()
.createQueryBuilder()
.update(SyncProgress)
.set({ blockEndNumber: 0, cursor: undefined })
.where({ walletId: Not(Equal(currentWallet?.id)) })
.execute()
}
}