Skip to content

Commit

Permalink
Remove unused Message.checksum.
Browse files Browse the repository at this point in the history
  • Loading branch information
schildbach committed Jul 23, 2015
1 parent 783dfc5 commit c169325
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 53 deletions.
11 changes: 0 additions & 11 deletions core/src/main/java/org/bitcoinj/core/AddressMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,6 @@ public int getMessageSize() {
return length;
}

/**
* AddressMessage cannot cache checksum in non-retain mode due to dynamic time being used.
*/
@Override
void setChecksum(byte[] checksum) {
if (parseRetain)
super.setChecksum(checksum);
else
this.checksum = null;
}

/**
* @return An unmodifiableList view of the backing List of addresses. Addresses contained within the list may be safely modified.
*/
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/java/org/bitcoinj/core/BitcoinSerializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,6 @@ private Message makeMessage(String command, int length, byte[] payloadBytes, byt
log.warn("No support for deserializing message with name {}", command);
return new UnknownMessage(params, command, payloadBytes);
}
if (checksum != null)
message.setChecksum(checksum);
return message;
}

Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/org/bitcoinj/core/Block.java
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,6 @@ private void unCacheHeader() {
if (!transactionBytesValid)
payload = null;
hash = null;
checksum = null;
}

private void unCacheTransactions() {
Expand Down
23 changes: 0 additions & 23 deletions core/src/main/java/org/bitcoinj/core/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ public abstract class Message {

protected int protocolVersion;

protected byte[] checksum;

protected NetworkParameters params;

protected Message() {
Expand Down Expand Up @@ -209,7 +207,6 @@ public void ensureParsed() throws ProtocolException {
*/
protected void unCache() {
maybeParse();
checksum = null;
payload = null;
recached = false;
}
Expand Down Expand Up @@ -248,26 +245,6 @@ public boolean isRecached() {
return recached;
}

/**
* Should only used by BitcoinSerializer for cached checksum
*
* @return the checksum
*/
byte[] getChecksum() {
return checksum;
}

/**
* Should only used by BitcoinSerializer for caching checksum
*
* @param checksum the checksum to set
*/
void setChecksum(byte[] checksum) {
if (checksum.length != 4)
throw new IllegalArgumentException("Checksum length must be 4 bytes, actual length: " + checksum.length);
this.checksum = checksum;
}

/**
* Returns a copy of the array returned by {@link Message#unsafeBitcoinSerialize()}, which is safe to mutate.
* If you need extra performance and can guarantee you won't write to the array, you can use the unsafe version.
Expand Down
16 changes: 0 additions & 16 deletions core/src/main/java/org/bitcoinj/core/VersionMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,22 +216,6 @@ public int hashCode() {
time, subVer, myAddr, theirAddr, relayTxesBeforeFilter);
}

/**
* VersionMessage does not handle cached byte array so should not have a cached checksum.
*/
@Override
byte[] getChecksum() {
throw new UnsupportedOperationException();
}

/**
* VersionMessage does not handle cached byte array so should not have a cached checksum.
*/
@Override
void setChecksum(byte[] checksum) {
throw new UnsupportedOperationException();
}

@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
Expand Down

0 comments on commit c169325

Please sign in to comment.