Message: remove method unCache()

It's still implemented in `Block`, `Transaction`, `TransactionInput` and
`TransactionOutput`. But there is no need to have it in the superclass.
This commit is contained in:
Andreas Schildbach 2023-03-30 11:42:57 +02:00
parent b9d37e024f
commit 6472080ab3
7 changed files with 0 additions and 18 deletions

View file

@ -46,7 +46,6 @@ public abstract class AddressMessage extends Message {
public abstract void addAddress(PeerAddress address);
public void removeAddress(int index) {
unCache();
PeerAddress address = addresses.remove(index);
}

View file

@ -326,7 +326,6 @@ public class Block extends Message {
writeTransactions(stream);
}
@Override
protected void unCache() {
// Since we have alternate uncache methods to use internally this will only ever be called by a child
// transaction so we only need to invalidate that part of the cache.

View file

@ -56,12 +56,10 @@ public abstract class ListMessage extends Message {
}
public void addItem(InventoryItem item) {
unCache();
items.add(item);
}
public void removeItem(int index) {
unCache();
items.remove(index);
}

View file

@ -91,15 +91,6 @@ public abstract class Message {
protected abstract void parse(ByteBuffer payload) throws BufferUnderflowException, ProtocolException;
/**
* <p>To be called before any change of internal values including any setters. This ensures any cached byte array is
* removed.</p>
* <p>Child messages of this object(e.g. Transactions belonging to a Block) will not have their internal byte caches
* invalidated unless they are also modified internally.</p>
*/
protected void unCache() {
}
/**
* <p>Serialize this message to a byte array that conforms to the bitcoin wire protocol.</p>
*

View file

@ -599,7 +599,6 @@ public class Transaction extends Message {
*/
public static final byte SIGHASH_ANYONECANPAY_VALUE = (byte) 0x80;
@Override
protected void unCache() {
cachedTxId = null;
cachedWTxId = null;

View file

@ -527,9 +527,7 @@ public class TransactionInput extends Message {
/* (non-Javadoc)
* @see Message#unCache()
*/
@Override
protected void unCache() {
super.unCache();
if (parent != null)
parent.unCache();
}

View file

@ -423,9 +423,7 @@ public class TransactionOutput extends Message {
/* (non-Javadoc)
* @see Message#unCache()
*/
@Override
protected void unCache() {
super.unCache();
if (parent != null)
parent.unCache();
}