AuxPoW extends ChildMessage { protected static long getNonceFromScript(final byte[] script, int pc) { final byte[] nonceBytes = Utils.reverseBytes(Arrays.copyOfRange(script, pc + 4, pc + 8)); return ByteBuffer.wrap(nonceBytes).getInt() & 0xffffffffl; } AuxPoW(NetworkParameters params, @Nullable Message parent);  AuxPoW(NetworkParameters params, byte[] payload, int offset, Message parent, MessageSerializer serializer);  AuxPoW(NetworkParameters params, byte[] payload, @Nullable Message parent, MessageSerializer serializer); int getOptimalEncodingMessageSize(); @Override String toString(); String toString(@Nullable AbstractBlockChain chain); @Override boolean equals(Object o); @Override int hashCode(); AltcoinBlock getParentBlockHeader(); Transaction getCoinbase(); MerkleBranch getChainMerkleBranch(); MerkleBranch getCoinbaseBranch(); Transaction getTransaction(); void setCoinbaseBranch(final MerkleBranch merkleBranch); void setParentBlockHeader(final AltcoinBlock header); static final byte[] MERGED_MINING_HEADER; }
@Test public void testGetNonceFromScript() { final byte[] script = Utils.HEX.decode("03251d0de4b883e5bda9e7a59ee4bb99e9b1bcfabe6d6dc6c83f297ee373df0d826f3148f218e4e4eb349e0bba715ad793ccc2d6beb6df40000000f09f909f4d696e65642062792079616e6779616e676368656e00000000000000000000000000000000"); final int pc = 55; final long expResult = 0x9f909ff0L; final long result = AuxPoW.getNonceFromScript(script, pc); assertEquals(expResult, result); }