AuxPoW extends ChildMessage { protected static int getExpectedIndex(final long nonce, final int chainId, final int merkleHeight) { int rand = (int) nonce; rand = rand * 1103515245 + 12345; rand += chainId; rand = rand * 1103515245 + 12345; long longRand = rand & 0xffffffffl; longRand %= (1 << merkleHeight); return (int) longRand; } 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 testGetExpectedIndex() { final long nonce = 0x9f909ff0L; final int chainId = 98; final int merkleHeight = 6; final int expResult = 40; final int result = AuxPoW.getExpectedIndex(nonce, chainId, merkleHeight); assertEquals(expResult, result); }