Skip to content

Commit

Permalink
fix BIP91 error, dogecoin#25
Browse files Browse the repository at this point in the history
  • Loading branch information
mrosseel committed Jun 22, 2017
1 parent 174f456 commit 25ef90c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions core/src/main/java/org/bitcoinj/core/AltcoinBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
package org.bitcoinj.core;

import org.libdohj.core.AltcoinNetworkParameters;
import com.google.common.base.Preconditions;
import org.libdohj.core.AuxPoWNetworkParameters;
import org.libdohj.core.ScryptHash;
import org.libdohj.params.AbstractLitecoinParams;

import javax.annotation.Nullable;
import java.io.ByteArrayOutputStream;
Expand All @@ -28,13 +30,9 @@
import java.security.GeneralSecurityException;
import java.util.BitSet;
import java.util.List;
import static org.bitcoinj.core.Coin.FIFTY_COINS;

import org.libdohj.core.ScryptHash;
import static org.libdohj.core.Utils.scryptDigest;

import static org.bitcoinj.core.Utils.reverseBytes;
import org.libdohj.core.AuxPoWNetworkParameters;
import static org.libdohj.core.Utils.scryptDigest;

/**
* <p>A block is a group of transactions, and is one of the fundamental data structures of the Bitcoin system.
Expand Down Expand Up @@ -172,8 +170,8 @@ public long getChainID() {

/**
* Return flags from block version of an AuxPoW-enabled chain.
*
* @return flags as a bitset.
*
* @return flags as a bitset.
*/
public BitSet getVersionFlags() {
final BitSet bitset = new BitSet(BYTE_BITS);
Expand Down Expand Up @@ -207,7 +205,9 @@ public static long getBaseVersion(final long rawVersion) {
@Override
public long getVersion() {
// TODO: Can we cache the individual parts on parse?
if (this.params instanceof AltcoinNetworkParameters) {
if(this.params instanceof AbstractLitecoinParams) {
return super.getVersion();
}else if (this.params instanceof AltcoinNetworkParameters) {
// AuxPoW networks use the higher block version bits for flags and
// chain ID.
return getBaseVersion(super.getVersion());
Expand Down

0 comments on commit 25ef90c

Please sign in to comment.