@Deprecated PublicKey duplicate() { PublicKey copy = new PublicKey(getBytes()); return copy; }
public Masternode(Context context) { super(context.getParams()); this.context = context; vin = null; address = null; pubKeyCollateralAddress = new PublicKey(); pubKeyMasternode = new PublicKey(); sig = null; activeState = State.MASTERNODE_ENABLED; sigTime = Utils.currentTimeSeconds(); lastPing = MasternodePing.EMPTY; cacheInputAge = 0; cacheInputAgeBlock = 0; unitTest = false; allowFreeTx = true; protocolVersion = CoinDefinition.PROTOCOL_VERSION; nLastDsq = 0; nScanningErrorCount = 0; nLastScanningErrorBlockHeight = 0; lastTimeChecked = 0; }
static public PublicKey recoverCompact(Sha256Hash hash, MasternodeSignature sig) throws SignatureException { if(sig.getBytes().length != 65) throw new SignatureException("signature is wrong size"); int recid = (sig.getBytes()[0] - 27) & 3; boolean comp = ((sig.getBytes()[0] - 27) & 4) != 0; //ECKey.ECDSASignature esig = ECKey.ECDSASignature.decodeFromDER(sig.getBytes()); BigInteger r = new BigInteger(1, Arrays.copyOfRange(sig.getBytes(), 1, 33)); BigInteger s = new BigInteger(1, Arrays.copyOfRange(sig.getBytes(), 33, 65)); ECKey.ECDSASignature esig = new ECKey.ECDSASignature(r, s); ECKey ecKey = ECKey.recoverFromSignature(recid, esig, hash, comp); return new PublicKey (ecKey.getPubKey()); }
PublicKey pubKey = new PublicKey(key.getPubKey()); StringBuilder strError = new StringBuilder();
@Override protected void parse() throws ProtocolException { vin = new TransactionInput(params, null, payload, cursor); cursor += vin.getMessageSize(); address = new MasternodeAddress(params, payload, cursor, 0); cursor += address.getMessageSize(); pubKeyCollateralAddress = new PublicKey(params, payload, cursor); cursor += pubKeyCollateralAddress.getMessageSize(); pubKeyMasternode = new PublicKey(params, payload, cursor); cursor += pubKeyMasternode.getMessageSize(); sig = new MasternodeSignature(params, payload, cursor); cursor += sig.getMessageSize(); sigTime = readInt64(); protocolVersion = (int)readUint32(); lastPing = new MasternodePing(params, payload, cursor); cursor += lastPing.getMessageSize(); //nLastDsq = readInt64(); length = cursor - offset; }
@Override protected void parse() throws ProtocolException { cursor = offset; optimalEncodingMessageSize = 0; TransactionOutPoint outpoint = new TransactionOutPoint(params, payload, cursor); cursor += outpoint.getMessageSize(); int scriptLen = (int) readVarInt(); byte [] scriptBytes = readBytes(scriptLen); long sequence = readUint32(); vin = new TransactionInput(params, null, scriptBytes, outpoint); optimalEncodingMessageSize += outpoint.getMessageSize() + scriptLen + VarInt.sizeOf(scriptLen) +4; pubkey = new PublicKey(params, payload, cursor); cursor += pubkey.getMessageSize(); pubkey2 = new PublicKey(params, payload, cursor); cursor += pubkey.getMessageSize(); vchSig = readByteArray(); sigTime = readInt64(); count = (int)readUint32(); current = (int)readUint32(); lastUpdated = readInt64(); protocolVersion = (int)readUint32(); length = cursor - offset; } @Override