Masternode extends Message { @Override protected void parse() throws ProtocolException { info = new MasternodeInfo(); info.outpoint = new TransactionOutPoint(params, payload, cursor); cursor += info.outpoint.getMessageSize(); info.address = new MasternodeAddress(params, payload, cursor, PROTOCOL_VERSION); cursor += info.address.getMessageSize(); info.pubKeyCollateralAddress = new PublicKey(params, payload, cursor); cursor += info.pubKeyCollateralAddress.getMessageSize(); info.pubKeyMasternode = new PublicKey(params, payload, cursor); cursor += info.pubKeyMasternode.getMessageSize(); vchSig = new MasternodeSignature(params, payload, cursor); cursor += vchSig.getMessageSize(); info.sigTime = readInt64(); info.nLastDsq = readInt64(); info.nTimeLastChecked = readInt64(); info.nTimeLastPaid = readInt64(); info.activeState = MasternodeInfo.State.forValue((int)readUint32()); nCollateralMinConfBlockHash = readHash(); nBlockLastPaid = (int)readUint32(); info.nProtocolVersion = (int)readUint32(); nPoSeBanScore = (int)readUint32(); nPoSeBanHeight = (int)readUint32(); fAllowMixingTx = readBytes(1)[0] == 1; fUnitTest = readBytes(1)[0] == 1; long entries = readVarInt(); mapGovernanceObjectsVotedOn = new HashMap<Sha256Hash, Integer>((int)entries); for(long i = 0; i < entries; ++i) { mapGovernanceObjectsVotedOn.put(readHash(), (int)readUint32()); } length = cursor - offset; lastPing = MasternodePing.EMPTY; } Masternode(Context context);  Masternode(NetworkParameters params, byte [] payload, int cursor);  Masternode(Context context, byte [] payload, int cursor);  Masternode(Masternode other);  Masternode(MasternodeBroadcast mnb); int calculateMessageSizeInBytes(); void masterNodeSerialize(OutputStream stream); void check(); void check(boolean forceCheck); boolean isEnabled(); boolean isPreEnabled(); boolean isPoSeBanned(); boolean isPoSeVerified(); boolean isExpired(); boolean isOutpointSpent(); boolean isUpdateRequired(); boolean isSentinelExpired(); boolean isNewStartRequired(); static String stateToString(MasternodeInfo.State nStateIn); String getStateString(); String getStatus(); MasternodeInfo getInfo(); boolean isValidNetAddr(); boolean isValidNetAddr(MasternodeAddress address); static Pair<CollateralStatus, Integer> checkCollateral(TransactionOutPoint outpoint); static final int MASTERNODE_CHECK_SECONDS; static final int MASTERNODE_MIN_MNB_SECONDS; static final int MASTERNODE_MIN_MNP_SECONDS; static final int MASTERNODE_EXPIRATION_SECONDS; static final int MASTERNODE_SENTINEL_MAX_SECONDS; static final int MASTERNODE_NEW_START_REQUIRED_SECONDS; static final int MASTERNODE_POSE_BAN_MAX_SCORE; }
@Test public void testParse() { byte [] mndata = Utils.HEX.decode( "09efcb66ff207c412e0c9817edc6ae73f4ee6ab69b78872f19c1e7f6da81ab530000000000000000000000000000ffff36bb35f04a3e21024844d13d64dd612147474caeb3ae9eff50daffec4cea17312ce3a8191573af5141042045b0853a5d097b39747b975a2e8cf952a7ac082367ba9b987158ec00a12e92848950444ddd416c7258268c91bffafdc0b14dd4877d488ce7abbe45bdc8469a411f1d574ccc8b7fe9ceba57d9d52e41665e0ac92e6db7fb01d733ff8bb7e59392973c27b199fa7532f1f3ad6a95ebc80685f8c48aa3cf7079650acc62f20f6647ebdddc5a5b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000421201000000000000000000000000"); PublicKey collateralAddress = new PublicKey(Utils.HEX.decode("024844d13d64dd612147474caeb3ae9eff50daffec4cea17312ce3a8191573af51")); Masternode mn = new Masternode(MainNetParams.get(), mndata, 0); MasternodeInfo info = mn.getInfo(); assertEquals(0, info.nLastDsq); assertEquals(1532681437, info.sigTime); assertEquals(70210, info.nProtocolVersion); assertEquals(collateralAddress, info.pubKeyCollateralAddress); assertEquals(false, mn.fAllowMixingTx); assertEquals(0, mn.mapGovernanceObjectsVotedOn.size()); }