Skip to content

Commit

Permalink
tests: add to SimplifiedMasternodeListEntryTest for new v19 fields
Browse files Browse the repository at this point in the history
Signed-off-by: HashEngineering <[email protected]>
  • Loading branch information
HashEngineering committed Dec 19, 2023
1 parent b98d86e commit 3497397
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ public void readBytesV1Test() {
byte[] smle = Utils.HEX.decode("318c32ec1598fa8f38dc76e28d15c00c20553c7020161a4c64742524a18465c39b2d789571a3b223a5365fbde69b3fe7143c4f9ebc6293afb84d340f0000000000000000000000000000ffff23a3e2204e1f08b4c1a8b9c1402ea84afe7c47f7e98d657df873b9747a0e4a497120ec62c81f314ad91a6f3384648e7e60f2734554f7f4c0fe75eec22907d6b043edb0df74ccc7b85a4500");
SimplifiedMasternodeListEntry entry = new SimplifiedMasternodeListEntry(UNITTEST, smle, 0, NetworkParameters.ProtocolVersion.BLS_LEGACY.getBitcoinProtocolVersion());
assertEquals(1, entry.version);
assertEquals(0, entry.type);
assertEquals(0, entry.getType());
assertEquals("c36584a1242574644c1a1620703c55200cc0158de276dc388ffa9815ec328c31", entry.proRegTxHash.toString());
assertEquals("000000000f344db8af9362bc9e4f3c14e73f9be6bd5f36a523b2a37195782d9b", entry.confirmedHash.toString());
assertEquals(new MasternodeAddress("35.163.226.32", 19999), entry.service);
assertEquals("yidavU3B2BUNzaUv3gW6nmV4ojLNwPeazt", Address.fromPubKeyHash(UNITTEST, entry.keyIdVoting.getBytes()).toString());
assertEquals(new BLSLazyPublicKey(UNITTEST, Utils.HEX.decode("08b4c1a8b9c1402ea84afe7c47f7e98d657df873b9747a0e4a497120ec62c81f314ad91a6f3384648e7e60f2734554f7"), 0, false), entry.pubKeyOperator);
assertFalse(entry.isValid); // this masternode is not valid
assertFalse(entry.isHPMN());
assertEquals(Sha256Hash.wrap("a7fc065ab65f453c4b57c597467f4d126188d5807f08cfab6b1f6d52e30e067e"), entry.getHash());
}

Expand All @@ -53,13 +54,15 @@ public void readBytesV2Test() {
byte[] smle = Utils.HEX.decode("0200e7aef4f585df3def44b855219ae93d6e8cc49a8c96658c5cc0813c48f5384c33e2999069d702d61d852a74b1e07d6f58101e0352d84043e866ff7946bdf5987f00000000000000000000ffff7f0000012f3197fe8172fd3207d71125a053ff32266e11110c06c1184d5be0a8118d0131d6119b138ec4d0398e7eacc5e16a75f718ed796c3a4cab668936c1f6d0945a7b97d7c0fee7cf0101002caa114755a4648d422a5caa5c915597f8c733b8e146");
SimplifiedMasternodeListEntry entry = new SimplifiedMasternodeListEntry(UNITTEST, smle, 0, NetworkParameters.ProtocolVersion.CURRENT.getBitcoinProtocolVersion());
assertEquals(2, entry.version);
assertEquals(1, entry.type);
assertEquals(1, entry.getType());
assertEquals("334c38f5483c81c05c8c65968c9ac48c6e3de99a2155b844ef3ddf85f5f4aee7", entry.proRegTxHash.toString());
assertEquals("7f98f5bd4679ff66e84340d852031e10586f7de0b1742a851dd602d7699099e2", entry.confirmedHash.toString());
assertEquals(new MasternodeAddress("127.0.0.1", 12081), entry.service);
assertEquals("yXPUGD63qih1Hzgxy7gY9LFKof2KqBf3hU", Address.fromPubKeyHash(UNITTEST, entry.keyIdVoting.getBytes()).toString());
assertEquals(new BLSLazyPublicKey(UNITTEST, Utils.HEX.decode("97fe8172fd3207d71125a053ff32266e11110c06c1184d5be0a8118d0131d6119b138ec4d0398e7eacc5e16a75f718ed"), 0, false), entry.pubKeyOperator);
assertEquals(KeyId.fromString("46e1b833c7f89755915caa5c2a428d64a4554711"), entry.platformNodeId);
assertEquals(KeyId.fromString("46e1b833c7f89755915caa5c2a428d64a4554711"), entry.getPlatformNodeId());
assertEquals(43564, entry.getPlatformHTTPPort());
assertTrue(entry.isHPMN());
assertTrue(entry.isValid);
}
}

0 comments on commit 3497397

Please sign in to comment.