Advance the cursor the full header length

Otherweise parsing the nonexistant transactions would reset the size of the message to 80
This commit is contained in:
langerhans
2015-10-24 21:58:48 +02:00
committed by Ross Nicoll
parent 1dcdff9f6e
commit 2c3466866c
2 changed files with 1 additions and 3 deletions

View File

@@ -204,7 +204,6 @@ public class AltcoinBlock extends org.bitcoinj.core.Block {
if (auxpowParams.isAuxPoWBlockVersion(this.getRawVersion()) if (auxpowParams.isAuxPoWBlockVersion(this.getRawVersion())
&& payload.length >= 160) { // We have at least 2 headers in an Aux block. Workaround for StoredBlocks && payload.length >= 160) { // We have at least 2 headers in an Aux block. Workaround for StoredBlocks
this.auxpow = new AuxPoW(params, payload, cursor, this, serializer); this.auxpow = new AuxPoW(params, payload, cursor, this, serializer);
optimalEncodingMessageSize += auxpow.getOptimalEncodingMessageSize();
} }
} }
@@ -218,6 +217,7 @@ public class AltcoinBlock extends org.bitcoinj.core.Block {
parseAuxPoW(); parseAuxPoW();
if (null != this.auxpow) { if (null != this.auxpow) {
super.parseTransactions(offset + auxpow.getMessageSize()); super.parseTransactions(offset + auxpow.getMessageSize());
optimalEncodingMessageSize += auxpow.getMessageSize();
} else { } else {
super.parseTransactions(offset); super.parseTransactions(offset);
} }

View File

@@ -141,8 +141,6 @@ public class AuxPoW extends ChildMessage {
} }
public int getOptimalEncodingMessageSize() { public int getOptimalEncodingMessageSize() {
if (optimalEncodingMessageSize != 0)
return optimalEncodingMessageSize;
if (optimalEncodingMessageSize != 0) if (optimalEncodingMessageSize != 0)
return optimalEncodingMessageSize; return optimalEncodingMessageSize;
optimalEncodingMessageSize = getMessageSize(); optimalEncodingMessageSize = getMessageSize();