@Test public void testParseWithSpork6() { byte [] mnpdata = Utils.HEX.decode( "07177e95b565dbaa3ecd8fd6377a7c558ee2e316add71a02e165421053589e6400000000bc44b6cc66045c277ddf0eb448eee00398aaf779986293026be90310000000002ae2405b00000000411b2794b633bfe27c90aa233026483a27686532327e634247ea3c8fa4b397599d0e164dda24b0a64a49a04def76032dfaba4977bd5f22b6a28fc0e5c373e7937cd0000100010088d50100"); Sha256Hash blockHash = Sha256Hash.wrap("000000001003e96b0293629879f7aa9803e0ee48b40edf7d275c0466ccb644bc"); MasternodePing mnp = new MasternodePing(MainNetParams.get(), mnpdata, 0); assertEquals(mnp.blockHash, blockHash); assertEquals(mnp.getHash(), Sha256Hash.wrap(Utils.HEX.decode("b0ee8ff1b74d8767fbd57868771b55fb70c47b10966b6371b99463cd8e4e1310"))); }
public Sha256Hash getHash(){ try { UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(vchSig.calculateMessageSizeInBytes()+8); if(context.sporkManager.isSporkActive(SporkManager.SPORK_6_NEW_SIGS)) { masternodeOutpoint.bitcoinSerialize(bos); bos.write(blockHash.getReversedBytes()); Utils.int64ToByteStreamLE(sigTime, bos); bos.write((byte)(sentinelIsCurrent ? 1: 0)); Utils.uint32ToByteStreamLE(sentinelVersion, bos); Utils.uint32ToByteStreamLE(daemonVersion, bos); } else { new TransactionInput(params, null, new byte[0], masternodeOutpoint).bitcoinSerialize(bos); Utils.int64ToByteStreamLE(sigTime, bos); } return Sha256Hash.wrapReversed(Sha256Hash.hashTwice(bos.toByteArray())); } catch (IOException e) { throw new RuntimeException(e); } }
MasternodePing extends Message implements Serializable { public Sha256Hash getHash(){ try { UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(vchSig.calculateMessageSizeInBytes()+8); if(context.sporkManager.isSporkActive(SporkManager.SPORK_6_NEW_SIGS)) { masternodeOutpoint.bitcoinSerialize(bos); bos.write(blockHash.getReversedBytes()); Utils.int64ToByteStreamLE(sigTime, bos); bos.write((byte)(sentinelIsCurrent ? 1: 0)); Utils.uint32ToByteStreamLE(sentinelVersion, bos); Utils.uint32ToByteStreamLE(daemonVersion, bos); } else { new TransactionInput(params, null, new byte[0], masternodeOutpoint).bitcoinSerialize(bos); Utils.int64ToByteStreamLE(sigTime, bos); } return Sha256Hash.wrapReversed(Sha256Hash.hashTwice(bos.toByteArray())); } catch (IOException e) { throw new RuntimeException(e); } } }
MasternodePing extends Message implements Serializable { public Sha256Hash getHash(){ try { UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(vchSig.calculateMessageSizeInBytes()+8); if(context.sporkManager.isSporkActive(SporkManager.SPORK_6_NEW_SIGS)) { masternodeOutpoint.bitcoinSerialize(bos); bos.write(blockHash.getReversedBytes()); Utils.int64ToByteStreamLE(sigTime, bos); bos.write((byte)(sentinelIsCurrent ? 1: 0)); Utils.uint32ToByteStreamLE(sentinelVersion, bos); Utils.uint32ToByteStreamLE(daemonVersion, bos); } else { new TransactionInput(params, null, new byte[0], masternodeOutpoint).bitcoinSerialize(bos); Utils.int64ToByteStreamLE(sigTime, bos); } return Sha256Hash.wrapReversed(Sha256Hash.hashTwice(bos.toByteArray())); } catch (IOException e) { throw new RuntimeException(e); } } MasternodePing(Context context);   MasternodePing(Context context, TransactionOutPoint outpoint);   MasternodePing(NetworkParameters params, byte[] bytes);   MasternodePing(NetworkParameters params, byte[] bytes, int cursor); }
MasternodePing extends Message implements Serializable { public Sha256Hash getHash(){ try { UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(vchSig.calculateMessageSizeInBytes()+8); if(context.sporkManager.isSporkActive(SporkManager.SPORK_6_NEW_SIGS)) { masternodeOutpoint.bitcoinSerialize(bos); bos.write(blockHash.getReversedBytes()); Utils.int64ToByteStreamLE(sigTime, bos); bos.write((byte)(sentinelIsCurrent ? 1: 0)); Utils.uint32ToByteStreamLE(sentinelVersion, bos); Utils.uint32ToByteStreamLE(daemonVersion, bos); } else { new TransactionInput(params, null, new byte[0], masternodeOutpoint).bitcoinSerialize(bos); Utils.int64ToByteStreamLE(sigTime, bos); } return Sha256Hash.wrapReversed(Sha256Hash.hashTwice(bos.toByteArray())); } catch (IOException e) { throw new RuntimeException(e); } } MasternodePing(Context context);   MasternodePing(Context context, TransactionOutPoint outpoint);   MasternodePing(NetworkParameters params, byte[] bytes);   MasternodePing(NetworkParameters params, byte[] bytes, int cursor); int calculateMessageSizeInBytes(); boolean checkSignature(PublicKey pubKeyMasternode, Dos nDos); Sha256Hash getSignatureHash(); boolean simpleCheck(Dos nDos); boolean equals(Object o); Sha256Hash getHash(); }
MasternodePing extends Message implements Serializable { public Sha256Hash getHash(){ try { UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(vchSig.calculateMessageSizeInBytes()+8); if(context.sporkManager.isSporkActive(SporkManager.SPORK_6_NEW_SIGS)) { masternodeOutpoint.bitcoinSerialize(bos); bos.write(blockHash.getReversedBytes()); Utils.int64ToByteStreamLE(sigTime, bos); bos.write((byte)(sentinelIsCurrent ? 1: 0)); Utils.uint32ToByteStreamLE(sentinelVersion, bos); Utils.uint32ToByteStreamLE(daemonVersion, bos); } else { new TransactionInput(params, null, new byte[0], masternodeOutpoint).bitcoinSerialize(bos); Utils.int64ToByteStreamLE(sigTime, bos); } return Sha256Hash.wrapReversed(Sha256Hash.hashTwice(bos.toByteArray())); } catch (IOException e) { throw new RuntimeException(e); } } MasternodePing(Context context);   MasternodePing(Context context, TransactionOutPoint outpoint);   MasternodePing(NetworkParameters params, byte[] bytes);   MasternodePing(NetworkParameters params, byte[] bytes, int cursor); int calculateMessageSizeInBytes(); boolean checkSignature(PublicKey pubKeyMasternode, Dos nDos); Sha256Hash getSignatureHash(); boolean simpleCheck(Dos nDos); boolean equals(Object o); Sha256Hash getHash(); static final int MASTERNODE_MIN_MNP_SECONDS; static final int MASTERNODE_MIN_MNB_SECONDS; static final int DEFAULT_SENTINEL_VERSION; static final int DEFAULT_DAEMON_VERSION; static final int CURRENT_DAEMON_VERSION; static MasternodePing EMPTY; }