mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-12 10:15:52 +00:00
Make isAvailableForSpending and markAsUnspent public. Add JavaDocs for them. Resolves issue 193.
This commit is contained in:
parent
7705bd59a4
commit
adb46c7dcb
@ -162,8 +162,9 @@ public class TransactionOutput extends ChildMessage implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this objects availableToSpend flag to false and the spentBy pointer to the given input.
|
* Sets this objects availableForSpending flag to false and the spentBy pointer to the given input.
|
||||||
* If the input is null, it means this output was signed over to somebody else rather than one of our own keys.
|
* If the input is null, it means this output was signed over to somebody else rather than one of our own keys.
|
||||||
|
* @throws IllegalStateException if the transaction was already marked as spent.
|
||||||
*/
|
*/
|
||||||
public void markAsSpent(TransactionInput input) {
|
public void markAsSpent(TransactionInput input) {
|
||||||
checkState(availableForSpending);
|
checkState(availableForSpending);
|
||||||
@ -171,12 +172,22 @@ public class TransactionOutput extends ChildMessage implements Serializable {
|
|||||||
spentBy = input;
|
spentBy = input;
|
||||||
}
|
}
|
||||||
|
|
||||||
void markAsUnspent() {
|
/**
|
||||||
|
* Resets the spent pointer / availableForSpending flag to null.
|
||||||
|
*/
|
||||||
|
public void markAsUnspent() {
|
||||||
availableForSpending = true;
|
availableForSpending = true;
|
||||||
spentBy = null;
|
spentBy = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isAvailableForSpending() {
|
/**
|
||||||
|
* Returns whether {@link TransactionOutput#markAsSpent(TransactionInput)} has been called on this class. A
|
||||||
|
* {@link Wallet} will mark a transaction output as spent once it sees a transaction input that is connected to it.
|
||||||
|
* Note that this flag can be false when an output has in fact been spent according to the rest of the network if
|
||||||
|
* the spending transaction wasn't downloaded yet, and it can be marked as spent when in reality the rest of the
|
||||||
|
* network believes it to be unspent if the signature or script connecting to it was not actually valid.
|
||||||
|
*/
|
||||||
|
public boolean isAvailableForSpending() {
|
||||||
return availableForSpending;
|
return availableForSpending;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user