Skip to content

Commit 66b6810

Browse files
committed
fix: don't restart when generate new address in normal sync
1 parent 50a3c73 commit 66b6810

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

packages/neuron-wallet/src/listeners/address.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ export const register = () => {
2828
walletIds.map(async id => {
2929
const wallet = WalletService.getInstance().get(id)
3030
const accountExtendedPublicKey: AccountExtendedPublicKey = wallet.accountExtendedPublicKey()
31-
await AddressService.checkAndGenerateSave(id, accountExtendedPublicKey, true, 20, 10)
31+
// set isImport to undefined means unknown
32+
await AddressService.checkAndGenerateSave(id, accountExtendedPublicKey, undefined, 20, 10)
3233
})
3334
)
3435
})

packages/neuron-wallet/src/startup/sync-block-task/indexer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ export const switchNetwork = async (nodeURL: string) => {
4343
const infos: LockHashInfo[] = (await Promise.all(
4444
addressWithWay.map(async aw => {
4545
const hashes: string[] = await LockUtils.addressToAllLockHashes(aw.address.address)
46+
// undefined means true
47+
const isImport: boolean = aw.isImport !== false
4648
return hashes.map(h => {
4749
return {
4850
lockHash: h,
49-
isImport: aw.isImport,
51+
isImport,
5052
}
5153
})
5254
})

packages/neuron-wallet/src/startup/sync-block-task/sync.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,12 @@ export const switchNetwork = async () => {
4444
const infos: LockHashInfo[] = (await Promise.all(
4545
addressWithWay.map(async aw => {
4646
const hashes: string[] = await LockUtils.addressToAllLockHashes(aw.address.address)
47+
// undefined means false
48+
const isImport: boolean = aw.isImport === true
4749
return hashes.map(h => {
4850
return {
4951
lockHash: h,
50-
isImport: aw.isImport,
52+
isImport,
5153
}
5254
})
5355
})

0 commit comments

Comments
 (0)