Skip to content

Commit e4ae783

Browse files
committed
fix: checkLockCodeHash
1 parent b40cb48 commit e4ae783

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

packages/neuron-wallet/src/database/chain/migrations/1744960856059-AddLockCodeHash.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@ export class AddLockCodeHash1744960856059 implements MigrationInterface {
1212
public async down(queryRunner: QueryRunner): Promise<void> {
1313
await queryRunner.query(`ALTER TABLE "multisig_config" DROP COLUMN "lockCodeHash";`)
1414
}
15+
}
1516

17+
export async function checkLockCodeHash(queryRunner: QueryRunner): Promise<void> {
18+
await queryRunner.query(`UPDATE "multisig_config" SET lockCodeHash = "${SystemScriptInfo.LEGACY_MULTISIG_CODE_HASH}" where lockCodeHash IS NULL`)
1619
}

packages/neuron-wallet/src/database/chain/ormconfig.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ import SudtTokenInfoSubscribe from './subscriber/sudt-token-info-subscriber'
7070
import AssetAccountSubscribe from './subscriber/asset-account-subscriber'
7171
import { AddStartBlockNumber1716539079505 } from './migrations/1716539079505-AddStartBlockNumber'
7272
import { AddUdtType1720089814860 } from './migrations/1720089814860-AddUdtType'
73-
import { AddLockCodeHash1744960856059 } from './migrations/1744960856059-AddLockCodeHash'
73+
import { AddLockCodeHash1744960856059, checkLockCodeHash } from './migrations/1744960856059-AddLockCodeHash'
7474

7575
export const CONNECTION_NOT_FOUND_NAME = 'ConnectionNotFoundError'
7676
export type ConnectionName = 'light' | 'full'
@@ -225,6 +225,12 @@ const initConnectionWithType = async (genesisBlockHash: string, connectionName:
225225
await dataSource[connectionName]?.initialize()
226226
await dataSource[connectionName]?.manager.query(`PRAGMA busy_timeout = 3000;`)
227227
await dataSource[connectionName]?.manager.query(`PRAGMA temp_store = MEMORY;`)
228+
229+
const queryRunner = dataSource[connectionName]?.createQueryRunner()
230+
if (queryRunner) {
231+
await checkLockCodeHash(queryRunner)
232+
await queryRunner.release()
233+
}
228234
} catch (err) {
229235
logger.error(err.message)
230236
}

0 commit comments

Comments
 (0)