Skip to content

Commit

Permalink
fix: Fix sync stop with exception and multisig balance.
Browse files Browse the repository at this point in the history
  • Loading branch information
yanguoyu committed Jun 12, 2023
1 parent e7adec4 commit ff018ff
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
23 changes: 16 additions & 7 deletions packages/neuron-wallet/src/services/asset-account-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,23 @@ export default class AssetAccountService {
.values(sudtTokenInfoEntity)
.onConflict(`("tokenID") DO NOTHING`)
.execute()

await getConnection()
const existAccountAcount = await getConnection()
.getRepository(AssetAccountEntity)
.createQueryBuilder()
.insert()
.into(AssetAccountEntity)
.values(assetAccountEntity)
.onConflict(`("tokenID", "blake160") DO NOTHING`)
.execute()
.where({
tokenID,
blake160
})
.getCount()
// check whether the entity exists before insert. Reason: https://github.com/Magickbase/neuron-public-issues/issues/184#issue-1749746997
if (!existAccountAcount) {
await getConnection()
.createQueryBuilder()
.insert()
.into(AssetAccountEntity)
.values(assetAccountEntity)
.execute()
}
}

public static async checkAndDeleteWhenFork(startBlockNumber: string, anyoneCanPayLockHashes: string[]) {
Expand Down
4 changes: 2 additions & 2 deletions packages/neuron-wallet/src/services/multisig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ export default class MultisigService {
const config = currentMultisigConfigs[idx]
const script = Multisig.getMultisigScript(config.blake160s, config.r, config.m, config.n)
addressCursorMap.set(script.args, v?.result?.last_cursor)
v.result.objects.forEach((transaction: any) => {
multisigOutputTxHashList.add(transaction.tx_hash)
v.result.objects.forEach((obj: any) => {
multisigOutputTxHashList.add(obj.tx_hash || obj.transaction?.hash)
})
nextMultisigConfigs.push(currentMultisigConfigs[idx])
}
Expand Down

0 comments on commit ff018ff

Please sign in to comment.