@@ -15,8 +15,8 @@ export default class SystemScriptInfo {
1515
1616 static SECP_HASH_TYPE = ScriptHashType . Type
1717 static DAO_HASH_TYPE = ScriptHashType . Type
18- static LEGACY_MULTI_SIGN_HASH_TYPE = ScriptHashType . Type
19- static MULTI_SIGN_HASH_TYPE = ScriptHashType . Data1
18+ static LEGACY_MULTISIGN_HASH_TYPE = ScriptHashType . Type
19+ static MULTISIGN_HASH_TYPE = ScriptHashType . Data1
2020
2121 static DAO_SCRIPT_HASH = new Script (
2222 systemScripts . DAO . CODE_HASH ,
@@ -41,11 +41,12 @@ export default class SystemScriptInfo {
4141 private legacyMultiSignOutPointInfo = new Map < string , OutPoint > ( )
4242 private multiSignOutPointInfo = new Map < string , OutPoint > ( )
4343
44- public static getMultiSignHashType ( lockCodeHash : string ) : ScriptHashType {
45- if ( lockCodeHash === SystemScriptInfo . MULTISIG_CODE_HASH ) {
46- return SystemScriptInfo . MULTI_SIGN_HASH_TYPE
44+ public static getMultiSignHashType ( lockCodeHash : string ) {
45+ if ( ! SystemScriptInfo . isMultiSignCodeHash ( lockCodeHash ) ) {
46+ throw new Error ( 'Unknown Multisig Code Hash' )
4747 }
48- return SystemScriptInfo . LEGACY_MULTI_SIGN_HASH_TYPE
48+ if ( lockCodeHash === SystemScriptInfo . MULTISIG_CODE_HASH ) return SystemScriptInfo . MULTISIGN_HASH_TYPE
49+ if ( lockCodeHash === SystemScriptInfo . LEGACY_MULTISIG_CODE_HASH ) return SystemScriptInfo . LEGACY_MULTISIGN_HASH_TYPE
4950 }
5051
5152 // need network url and genesisBlockHash
@@ -119,9 +120,9 @@ export default class SystemScriptInfo {
119120 public static isMultiSignScript ( script : Script ) : boolean {
120121 return (
121122 ( script . codeHash === SystemScriptInfo . LEGACY_MULTISIG_CODE_HASH &&
122- script . hashType === SystemScriptInfo . LEGACY_MULTI_SIGN_HASH_TYPE ) ||
123+ script . hashType === SystemScriptInfo . LEGACY_MULTISIGN_HASH_TYPE ) ||
123124 ( script . codeHash === SystemScriptInfo . MULTISIG_CODE_HASH &&
124- script . hashType === SystemScriptInfo . MULTI_SIGN_HASH_TYPE )
125+ script . hashType === SystemScriptInfo . MULTISIGN_HASH_TYPE )
125126 )
126127 }
127128
0 commit comments