mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-22 22:25:41 +01:00
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:
parent
b9d37e024f
commit
6472080ab3
7 changed files with 0 additions and 18 deletions
|
@ -46,7 +46,6 @@ public abstract class AddressMessage extends Message {
|
||||||
public abstract void addAddress(PeerAddress address);
|
public abstract void addAddress(PeerAddress address);
|
||||||
|
|
||||||
public void removeAddress(int index) {
|
public void removeAddress(int index) {
|
||||||
unCache();
|
|
||||||
PeerAddress address = addresses.remove(index);
|
PeerAddress address = addresses.remove(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -326,7 +326,6 @@ public class Block extends Message {
|
||||||
writeTransactions(stream);
|
writeTransactions(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void unCache() {
|
protected void unCache() {
|
||||||
// Since we have alternate uncache methods to use internally this will only ever be called by a child
|
// 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.
|
// transaction so we only need to invalidate that part of the cache.
|
||||||
|
|
|
@ -56,12 +56,10 @@ public abstract class ListMessage extends Message {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addItem(InventoryItem item) {
|
public void addItem(InventoryItem item) {
|
||||||
unCache();
|
|
||||||
items.add(item);
|
items.add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeItem(int index) {
|
public void removeItem(int index) {
|
||||||
unCache();
|
|
||||||
items.remove(index);
|
items.remove(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,15 +91,6 @@ public abstract class Message {
|
||||||
|
|
||||||
protected abstract void parse(ByteBuffer payload) throws BufferUnderflowException, ProtocolException;
|
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>
|
* <p>Serialize this message to a byte array that conforms to the bitcoin wire protocol.</p>
|
||||||
*
|
*
|
||||||
|
|
|
@ -599,7 +599,6 @@ public class Transaction extends Message {
|
||||||
*/
|
*/
|
||||||
public static final byte SIGHASH_ANYONECANPAY_VALUE = (byte) 0x80;
|
public static final byte SIGHASH_ANYONECANPAY_VALUE = (byte) 0x80;
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void unCache() {
|
protected void unCache() {
|
||||||
cachedTxId = null;
|
cachedTxId = null;
|
||||||
cachedWTxId = null;
|
cachedWTxId = null;
|
||||||
|
|
|
@ -527,9 +527,7 @@ public class TransactionInput extends Message {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see Message#unCache()
|
* @see Message#unCache()
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
protected void unCache() {
|
protected void unCache() {
|
||||||
super.unCache();
|
|
||||||
if (parent != null)
|
if (parent != null)
|
||||||
parent.unCache();
|
parent.unCache();
|
||||||
}
|
}
|
||||||
|
|
|
@ -423,9 +423,7 @@ public class TransactionOutput extends Message {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see Message#unCache()
|
* @see Message#unCache()
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
protected void unCache() {
|
protected void unCache() {
|
||||||
super.unCache();
|
|
||||||
if (parent != null)
|
if (parent != null)
|
||||||
parent.unCache();
|
parent.unCache();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue