3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-11 17:55:53 +00:00

Update subclasses to match bitcoinj API changes

Update AltcoinBlock and AltcoinSerializer to handle offset as a parameter
when parsing blocks.
This commit is contained in:
Ross Nicoll 2015-10-23 20:55:35 +01:00
parent 29d11d357b
commit 95060faa20
2 changed files with 13 additions and 13 deletions

View File

@ -60,14 +60,18 @@ public class AltcoinBlock extends org.bitcoinj.core.Block {
private ScryptHash scryptHash;
/** Special case constructor, used for the genesis node, cloneAsHeader and unit tests. */
/** Special case constructor, used for the genesis node, cloneAsHeader and unit tests.
* @param params NetworkParameters object.
*/
public AltcoinBlock(final NetworkParameters params, final long version) {
super(params, version);
}
/** Special case constructor, used for the genesis node, cloneAsHeader and unit tests. */
public AltcoinBlock(NetworkParameters params, byte[] payloadBytes) {
this(params, payloadBytes, params.getDefaultSerializer(), payloadBytes.length);
/** Special case constructor, used for the genesis node, cloneAsHeader and unit tests.
* @param params NetworkParameters object.
*/
public AltcoinBlock(final NetworkParameters params, final byte[] payloadBytes) {
this(params, payloadBytes, 0, params.getDefaultSerializer(), payloadBytes.length);
}
/**
@ -78,9 +82,10 @@ public class AltcoinBlock extends org.bitcoinj.core.Block {
* as the length will be provided as part of the header. If unknown then set to Message.UNKNOWN_LENGTH
* @throws ProtocolException
*/
public AltcoinBlock(NetworkParameters params, byte[] payloadBytes, MessageSerializer serializer, int length)
public AltcoinBlock(final NetworkParameters params, final byte[] payloadBytes,
final int offset, final MessageSerializer serializer, final int length)
throws ProtocolException {
super(params, payloadBytes, serializer, length);
super(params, payloadBytes, offset, serializer, length);
}
public AltcoinBlock(NetworkParameters params, byte[] payloadBytes, int offset,

View File

@ -22,12 +22,7 @@ public class AltcoinSerializer extends BitcoinSerializer {
}
@Override
public Block makeBlock(byte[] payloadBytes) throws ProtocolException {
return new AltcoinBlock(getParameters(), payloadBytes, this, payloadBytes.length);
}
@Override
public Block makeBlock(byte[] payloadBytes, int length) throws ProtocolException {
return new AltcoinBlock(getParameters(), payloadBytes, this, length);
public Block makeBlock(final byte[] payloadBytes, final int offset, final int length) throws ProtocolException {
return new AltcoinBlock(getParameters(), payloadBytes, offset, this, length);
}
}