Skip to content

Commit 3fb5a88

Browse files
committed
fix: Issues of release v0.201.0 regression
1 parent 113c814 commit 3fb5a88

File tree

5 files changed

+44
-5
lines changed

5 files changed

+44
-5
lines changed

packages/neuron-wallet/src/block-sync-renderer/sync/indexer-cache-service.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ export default class IndexerCacheService {
111111
lockScript: addressMeta.generateSingleMultiSignLockScript(),
112112
argsLen: 28,
113113
},
114+
{
115+
lockScript: addressMeta.generateLegacySingleMultiSignLockScript(),
116+
argsLen: 28,
117+
},
114118
{
115119
lockScript: addressMeta.generateChequeLockScriptWithReceiverLockHash(),
116120
argsLen: 40,

packages/neuron-wallet/src/database/address/meta.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,17 @@ export default class AddressMeta implements Address {
100100
return SystemScriptInfo.generateSecpScript(this.blake160)
101101
}
102102

103-
public generateSingleMultiSignLockScript(): Script {
103+
public generateLegacySingleMultiSignLockScript(): Script {
104104
return SystemScriptInfo.generateMultiSignScript(
105105
Multisig.hash([this.blake160]),
106106
SystemScriptInfo.LEGACY_MULTISIG_CODE_HASH
107107
)
108108
}
109109

110+
public generateSingleMultiSignLockScript(): Script {
111+
return SystemScriptInfo.generateMultiSignScript(Multisig.hash([this.blake160]), SystemScriptInfo.MULTISIG_CODE_HASH)
112+
}
113+
110114
public generateACPLockScript(): Script {
111115
const assetAccountInfo = new AssetAccountInfo()
112116
return assetAccountInfo.generateAnyoneCanPayScript(this.blake160)

packages/neuron-wallet/src/services/cells.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ export default class CellsService {
320320
(
321321
output.hasData = 0 AND
322322
output.typeHash IS NULL AND
323-
output.lockCodeHash = :multiSignlockCodeHash
323+
output.lockCodeHash in (:...multiSignlockCodeHash)
324324
)
325325
OR
326326
(
@@ -353,7 +353,7 @@ export default class CellsService {
353353
`,
354354
{
355355
liveStatus: OutputStatus.Live,
356-
multiSignlockCodeHash: SystemScriptInfo.LEGACY_MULTISIG_CODE_HASH,
356+
multiSignlockCodeHash: [SystemScriptInfo.LEGACY_MULTISIG_CODE_HASH, SystemScriptInfo.MULTISIG_CODE_HASH],
357357
chequeLockCodeHash,
358358
nftIssuerCodehash,
359359
nftClassCodehash,
@@ -467,7 +467,9 @@ export default class CellsService {
467467
data: 'withdraw-able',
468468
})
469469
}
470-
} else if (o.lockCodeHash === SystemScriptInfo.LEGACY_MULTISIG_CODE_HASH) {
470+
} else if (
471+
[SystemScriptInfo.LEGACY_MULTISIG_CODE_HASH, SystemScriptInfo.MULTISIG_CODE_HASH].includes(o.lockCodeHash)
472+
) {
471473
cell.setCustomizedAssetInfo({
472474
lock: CustomizedLock.SingleMultiSign,
473475
type: '',
@@ -770,7 +772,9 @@ export default class CellsService {
770772
if (inputs.find(el => el.lockHash === cell.lockHash!)) {
771773
totalSize += TransactionSize.emptyWitness()
772774
} else {
773-
if (lockClass.codeHash === SystemScriptInfo.LEGACY_MULTISIG_CODE_HASH) {
775+
if (
776+
[SystemScriptInfo.LEGACY_MULTISIG_CODE_HASH, SystemScriptInfo.MULTISIG_CODE_HASH].includes(lockClass.codeHash)
777+
) {
774778
const multisigConfig = multisigConfigMap[cell.lockHash]
775779
if (!multisigConfig) {
776780
throw new MultisigConfigNeedError()
@@ -1374,6 +1378,7 @@ export default class CellsService {
13741378
case assetAccountInfo.getChequeInfo().codeHash:
13751379
return LockScriptCategory.Cheque
13761380
case SystemScriptInfo.LEGACY_MULTISIG_CODE_HASH:
1381+
case SystemScriptInfo.MULTISIG_CODE_HASH:
13771382
if (output.lock.args.length === LOCKTIME_ARGS_LENGTH) {
13781383
return LockScriptCategory.MULTI_LOCK_TIME
13791384
}

packages/neuron-wallet/tests/block-sync-renderer/indexer-cache-service.intg.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ const addressMeta = AddressMeta.fromObject(address)
7070
const addressMetas = [addressMeta]
7171
const defaultLockScript = addressMeta.generateDefaultLockScript()
7272
const singleMultiSignLockScript = addressMeta.generateSingleMultiSignLockScript()
73+
const legacySingleMultiSignLockScript = addressMeta.generateLegacySingleMultiSignLockScript()
7374
const chequeLockScript = addressMeta.generateChequeLockScriptWithReceiverLockHash()
7475
const acpLockScript = addressMeta.generateACPLockScript()
7576
const legacyAcpLockScript = addressMeta.generateLegacyACPLockScript()
@@ -83,6 +84,11 @@ const formattedSingleMultiSignLockScript = {
8384
hashType: singleMultiSignLockScript.hashType,
8485
args: singleMultiSignLockScript.args + '0'.repeat(14),
8586
}
87+
const formattedLegacySingleMultiSignLockScript = {
88+
codeHash: legacySingleMultiSignLockScript.codeHash,
89+
hashType: legacySingleMultiSignLockScript.hashType,
90+
args: legacySingleMultiSignLockScript.args + '0'.repeat(14),
91+
}
8692
const formattedChequeLockScript = {
8793
codeHash: chequeLockScript.codeHash,
8894
hashType: chequeLockScript.hashType,
@@ -276,6 +282,17 @@ describe('indexer cache service', () => {
276282

277283
stubbedCellCollectorConstructor.mockReset()
278284
when(stubbedCellCollectorConstructor)
285+
.calledWith(
286+
expect.anything(),
287+
expect.objectContaining({
288+
lock: {
289+
...formattedLegacySingleMultiSignLockScript,
290+
args: formattedLegacySingleMultiSignLockScript.args.slice(0, 42),
291+
},
292+
argsLen: 28,
293+
})
294+
)
295+
.mockReturnValue(fakeCollectorObj)
279296
.calledWith(
280297
expect.anything(),
281298
expect.objectContaining({

packages/neuron-wallet/tests/database/address/meta.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ describe('Address Dao tests', () => {
4242

4343
it('#generateSingleMultiSignLockScript', () => {
4444
const script = addressMeta.generateSingleMultiSignLockScript()
45+
expect(script).toEqual({
46+
args: Multisig.hash([address.blake160]),
47+
codeHash: '0x36c971b8d41fbd94aabca77dc75e826729ac98447b46f91e00796155dddb0d29',
48+
hashType: 'data1',
49+
})
50+
})
51+
52+
it('#generateLegacySingleMultiSignLockScript', () => {
53+
const script = addressMeta.generateLegacySingleMultiSignLockScript()
4554
expect(script).toEqual({
4655
args: Multisig.hash([address.blake160]),
4756
codeHash: '0x5c5069eb0857efc65e1bca0c07df34c31663b3622fd3876c876320fc9634e2a8',

0 commit comments

Comments
 (0)