Skip to content

Commit

Permalink
fix: don't restart when generate new address in normal sync
Browse files Browse the repository at this point in the history
  • Loading branch information
classicalliu committed Aug 20, 2019
1 parent 50a3c73 commit 66b6810
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/neuron-wallet/src/listeners/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export const register = () => {
walletIds.map(async id => {
const wallet = WalletService.getInstance().get(id)
const accountExtendedPublicKey: AccountExtendedPublicKey = wallet.accountExtendedPublicKey()
await AddressService.checkAndGenerateSave(id, accountExtendedPublicKey, true, 20, 10)
// set isImport to undefined means unknown
await AddressService.checkAndGenerateSave(id, accountExtendedPublicKey, undefined, 20, 10)
})
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ export const switchNetwork = async (nodeURL: string) => {
const infos: LockHashInfo[] = (await Promise.all(
addressWithWay.map(async aw => {
const hashes: string[] = await LockUtils.addressToAllLockHashes(aw.address.address)
// undefined means true
const isImport: boolean = aw.isImport !== false
return hashes.map(h => {
return {
lockHash: h,
isImport: aw.isImport,
isImport,
}
})
})
Expand Down
4 changes: 3 additions & 1 deletion packages/neuron-wallet/src/startup/sync-block-task/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ export const switchNetwork = async () => {
const infos: LockHashInfo[] = (await Promise.all(
addressWithWay.map(async aw => {
const hashes: string[] = await LockUtils.addressToAllLockHashes(aw.address.address)
// undefined means false
const isImport: boolean = aw.isImport === true
return hashes.map(h => {
return {
lockHash: h,
isImport: aw.isImport,
isImport,
}
})
})
Expand Down

0 comments on commit 66b6810

Please sign in to comment.