Skip to content

Commit 1313145

Browse files
committed
fix: comments
1 parent e7cf459 commit 1313145

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

packages/neuron-ui/src/widgets/MigrateCkbDataDialog/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ const MigrateCkbDataDialog = ({
2828
const [seconds, setSeconds] = useState(5)
2929

3030
const openPath = (e: React.SyntheticEvent<HTMLButtonElement>) => {
31-
const btn = (e.target as HTMLButtonElement)?.closest('button')
32-
if (btn?.dataset?.path) {
33-
shell.openPath(btn?.dataset?.path)
34-
}
31+
const elm = e.target
32+
if (!(elm instanceof HTMLButtonElement)) return
33+
const { path } = elm.dataset
34+
if (!path) return
35+
shell.openPath(path)
3536
}
3637

3738
useEffect(() => {

packages/neuron-wallet/src/controllers/api.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import fs from 'fs'
1919
import env from '../env'
2020
import { showWindow } from './app/show-window'
2121
import CommonUtils from '../utils/common'
22+
import { CKB_NODE_DATA_SIZE_BUFFER_RATIO } from '../utils/const'
2223
import { NetworkType, Network } from '../models/network'
2324
import { ConnectionStatusSubject } from '../models/subjects/node'
2425
import NetworksService from '../services/networks'
@@ -767,7 +768,7 @@ export default class ApiController {
767768
status: ResponseCode.Success,
768769
result: {
769770
isFirstSync: SettingsService.getInstance().isFirstSync && currentNetwork.type === NetworkType.Default,
770-
needSize: Math.ceil(+process.env.CKB_NODE_DATA_SIZE! * 1.2),
771+
needSize: Math.ceil(+process.env.CKB_NODE_DATA_SIZE! * CKB_NODE_DATA_SIZE_BUFFER_RATIO),
771772
ckbNodeDataPath: SettingsService.getInstance().getNodeDataPath(),
772773
},
773774
}
@@ -784,7 +785,7 @@ export default class ApiController {
784785
handle('get-ckb-node-data-need-size', () => {
785786
return {
786787
status: ResponseCode.Success,
787-
result: Math.ceil(+process.env.CKB_NODE_DATA_SIZE! * 1.2),
788+
result: Math.ceil(+process.env.CKB_NODE_DATA_SIZE! * CKB_NODE_DATA_SIZE_BUFFER_RATIO),
788789
}
789790
})
790791

packages/neuron-wallet/src/utils/const.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const START_WITHOUT_INDEXER = -4
1818
export const DEFAULT_ARGS_LENGTH = 42
1919
export const LOCKTIME_ARGS_LENGTH = 58
2020
export const CHEQUE_ARGS_LENGTH = 82
21+
export const CKB_NODE_DATA_SIZE_BUFFER_RATIO = 1.2
2122

2223
export enum ResponseCode {
2324
Fail,

0 commit comments

Comments
 (0)