@Test public void testGetSigningThreshold() { String key = OpCode.PUSHDATA1.toString() + "21" + "02028a99826edc0c97d18e22b6932373d908d323aa7f92656a77ec26e8861699ef"; StringBuilder sb = new StringBuilder(); sb.append(OpCode.PUSH2.toString()); IntStream.range(0, 3).forEach(i -> sb.append(key)); sb.append(OpCode.PUSH3.toString()); sb.append(OpCode.PUSHNULL.toString()); sb.append(OpCode.SYSCALL.toString()); sb.append(InteropServiceCode.NEO_CRYPTO_CHECKMULTISIGWITHECDSASECP256R1.getHash()); byte[] script = Numeric.hexStringToByteArray(sb.toString()); assertEquals(2, new VerificationScript(script).getSigningThreshold()); StringBuilder sb2 = new StringBuilder(); sb2.append(OpCode.PUSHINT8.toString()); sb2.append("7f"); IntStream.range(0, 127).forEach(i -> sb2.append(key)); sb2.append(OpCode.PUSHINT8.toString()); sb2.append("7f"); sb2.append(OpCode.PUSHNULL.toString()); sb2.append(OpCode.SYSCALL.toString()); sb2.append(InteropServiceCode.NEO_CRYPTO_CHECKMULTISIGWITHECDSASECP256R1.getHash()); script = Numeric.hexStringToByteArray(sb2.toString()); assertEquals(127, new VerificationScript(script).getSigningThreshold()); }
public int getSigningThreshold() { if (isSingleSigScript()) { return 1; } else if (isMultiSigScript()) { try { return new BinaryReader(script).readPushInteger(); } catch (DeserializationException e) { throw new RuntimeException(e); } } throw new ScriptFormatException("The signing threshold cannot be determined because this " + "script does not apply to the format of a signature verification script."); }
VerificationScript extends NeoSerializable { public int getSigningThreshold() { if (isSingleSigScript()) { return 1; } else if (isMultiSigScript()) { try { return new BinaryReader(script).readPushInteger(); } catch (DeserializationException e) { throw new RuntimeException(e); } } throw new ScriptFormatException("The signing threshold cannot be determined because this " + "script does not apply to the format of a signature verification script."); } }
VerificationScript extends NeoSerializable { public int getSigningThreshold() { if (isSingleSigScript()) { return 1; } else if (isMultiSigScript()) { try { return new BinaryReader(script).readPushInteger(); } catch (DeserializationException e) { throw new RuntimeException(e); } } throw new ScriptFormatException("The signing threshold cannot be determined because this " + "script does not apply to the format of a signature verification script."); } VerificationScript();  VerificationScript(byte[] script);  VerificationScript(ECPublicKey publicKey);  VerificationScript(List<ECPublicKey> publicKeys, int signingThreshold); }
VerificationScript extends NeoSerializable { public int getSigningThreshold() { if (isSingleSigScript()) { return 1; } else if (isMultiSigScript()) { try { return new BinaryReader(script).readPushInteger(); } catch (DeserializationException e) { throw new RuntimeException(e); } } throw new ScriptFormatException("The signing threshold cannot be determined because this " + "script does not apply to the format of a signature verification script."); } VerificationScript();  VerificationScript(byte[] script);  VerificationScript(ECPublicKey publicKey);  VerificationScript(List<ECPublicKey> publicKeys, int signingThreshold); byte[] getScript(); @Override byte[] toArray(); ScriptHash getScriptHash(); @Override int getSize(); int getSigningThreshold(); int getNrOfAccounts(); boolean isSingleSigScript(); boolean isMultiSigScript(); List<ECPublicKey> getPublicKeys(); @Override void deserialize(BinaryReader reader); @Override void serialize(BinaryWriter writer); @Override boolean equals(Object o); @Override int hashCode(); }
VerificationScript extends NeoSerializable { public int getSigningThreshold() { if (isSingleSigScript()) { return 1; } else if (isMultiSigScript()) { try { return new BinaryReader(script).readPushInteger(); } catch (DeserializationException e) { throw new RuntimeException(e); } } throw new ScriptFormatException("The signing threshold cannot be determined because this " + "script does not apply to the format of a signature verification script."); } VerificationScript();  VerificationScript(byte[] script);  VerificationScript(ECPublicKey publicKey);  VerificationScript(List<ECPublicKey> publicKeys, int signingThreshold); byte[] getScript(); @Override byte[] toArray(); ScriptHash getScriptHash(); @Override int getSize(); int getSigningThreshold(); int getNrOfAccounts(); boolean isSingleSigScript(); boolean isMultiSigScript(); List<ECPublicKey> getPublicKeys(); @Override void deserialize(BinaryReader reader); @Override void serialize(BinaryWriter writer); @Override boolean equals(Object o); @Override int hashCode();  }