mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-23 14:40:40 +01:00
Transaction, TransactionInput, TransactionOutput: remove unCache()
This commit is contained in:
parent
b8d3c4a641
commit
1346504fb0
3 changed files with 0 additions and 40 deletions
|
@ -587,9 +587,6 @@ public class Transaction extends Message {
|
|||
*/
|
||||
public static final byte SIGHASH_ANYONECANPAY_VALUE = (byte) 0x80;
|
||||
|
||||
protected void unCache() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserialize according to <a href="https://github.com/bitcoin/bips/blob/master/bip-0144.mediawiki">BIP144</a> or
|
||||
* the <a href="https://en.bitcoin.it/wiki/Protocol_documentation#tx">classic format</a>, depending on if the
|
||||
|
@ -874,7 +871,6 @@ public class Transaction extends Message {
|
|||
* Note that this also invalidates the length attribute
|
||||
*/
|
||||
public void clearInputs() {
|
||||
unCache();
|
||||
for (TransactionInput input : inputs) {
|
||||
input.setParent(null);
|
||||
}
|
||||
|
@ -897,7 +893,6 @@ public class Transaction extends Message {
|
|||
* @return the new input.
|
||||
*/
|
||||
public TransactionInput addInput(TransactionInput input) {
|
||||
unCache();
|
||||
input.setParent(this);
|
||||
inputs.add(input);
|
||||
return input;
|
||||
|
@ -1036,7 +1031,6 @@ public class Transaction extends Message {
|
|||
* Note that this also invalidates the length attribute
|
||||
*/
|
||||
public void clearOutputs() {
|
||||
unCache();
|
||||
for (TransactionOutput output : outputs) {
|
||||
output.setParent(null);
|
||||
}
|
||||
|
@ -1047,7 +1041,6 @@ public class Transaction extends Message {
|
|||
* Adds the given output to this transaction. The output must be completely initialized. Returns the given output.
|
||||
*/
|
||||
public TransactionOutput addOutput(TransactionOutput to) {
|
||||
unCache();
|
||||
to.setParent(this);
|
||||
outputs.add(to);
|
||||
return to;
|
||||
|
@ -1519,7 +1512,6 @@ public class Transaction extends Message {
|
|||
* standard and won't be relayed or included in the memory pool either.
|
||||
*/
|
||||
public void setLockTime(long lockTime) {
|
||||
unCache();
|
||||
boolean seqNumSet = false;
|
||||
for (TransactionInput input : inputs) {
|
||||
if (input.getSequenceNumber() != TransactionInput.NO_SEQUENCE) {
|
||||
|
@ -1541,7 +1533,6 @@ public class Transaction extends Message {
|
|||
|
||||
public void setVersion(int version) {
|
||||
this.version = version;
|
||||
unCache();
|
||||
}
|
||||
|
||||
/** Returns an unmodifiable view of all inputs. */
|
||||
|
|
|
@ -257,7 +257,6 @@ public class TransactionInput {
|
|||
public void setSequenceNumber(long sequence) {
|
||||
checkArgument(sequence >= 0 && sequence <= ByteUtils.MAX_UNSIGNED_INTEGER, () ->
|
||||
"sequence out of range: " + sequence);
|
||||
unCache();
|
||||
this.sequence = sequence;
|
||||
}
|
||||
|
||||
|
@ -288,7 +287,6 @@ public class TransactionInput {
|
|||
* @param scriptBytes the scriptBytes to set
|
||||
*/
|
||||
void setScriptBytes(byte[] scriptBytes) {
|
||||
unCache();
|
||||
this.scriptSig = null;
|
||||
this.scriptBytes = scriptBytes;
|
||||
}
|
||||
|
@ -538,23 +536,9 @@ public class TransactionInput {
|
|||
}
|
||||
|
||||
protected final void setParent(@Nullable Transaction parent) {
|
||||
if (this.parent != null && this.parent != parent && parent != null) {
|
||||
// After old parent is unlinked it won't be able to receive notice if this child
|
||||
// changes internally. To be safe we invalidate the parent cache to ensure it rebuilds
|
||||
// manually on serialization.
|
||||
this.parent.unCache();
|
||||
}
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see Message#unCache()
|
||||
*/
|
||||
protected void unCache() {
|
||||
if (parent != null)
|
||||
parent.unCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
|
|
@ -182,7 +182,6 @@ public class TransactionOutput {
|
|||
// Negative values obviously make no sense, except for -1 which is used as a sentinel value when calculating
|
||||
// SIGHASH_SINGLE signatures, so unfortunately we have to allow that here.
|
||||
checkArgument(value.signum() >= 0 || value.equals(Coin.NEGATIVE_SATOSHI), () -> "value out of range: " + value);
|
||||
unCache();
|
||||
this.value = value.value;
|
||||
}
|
||||
|
||||
|
@ -438,23 +437,9 @@ public class TransactionOutput {
|
|||
}
|
||||
|
||||
protected final void setParent(@Nullable Transaction parent) {
|
||||
if (this.parent != null && this.parent != parent && parent != null) {
|
||||
// After old parent is unlinked it won't be able to receive notice if this child
|
||||
// changes internally. To be safe we invalidate the parent cache to ensure it rebuilds
|
||||
// manually on serialization.
|
||||
this.parent.unCache();
|
||||
}
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see Message#unCache()
|
||||
*/
|
||||
protected void unCache() {
|
||||
if (parent != null)
|
||||
parent.unCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
|
Loading…
Add table
Reference in a new issue