3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-15 11:45:51 +00:00

When connecting outputs to inputs, cache its value in the input. This will make sure the fee is also known after a blockchain replay.

This commit is contained in:
Andreas Schildbach 2014-12-19 23:27:46 +01:00
parent 4d3297d334
commit 18c63a703f

View File

@ -60,7 +60,7 @@ public class TransactionInput extends ChildMessage implements Serializable {
transient private WeakReference<Script> scriptSig; transient private WeakReference<Script> scriptSig;
/** Value of the output connected to the input, if known. This field does not participate in equals()/hashCode(). */ /** Value of the output connected to the input, if known. This field does not participate in equals()/hashCode(). */
@Nullable @Nullable
private final Coin value; private Coin value;
/** /**
* Creates an input that connects to nothing - used only in creation of coinbase transactions. * Creates an input that connects to nothing - used only in creation of coinbase transactions.
@ -375,6 +375,7 @@ public class TransactionInput extends ChildMessage implements Serializable {
public void connect(TransactionOutput out) { public void connect(TransactionOutput out) {
outpoint.fromTx = out.getParentTransaction(); outpoint.fromTx = out.getParentTransaction();
out.markAsSpent(this); out.markAsSpent(this);
value = out.getValue();
} }
/** /**