mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-20 22:25:50 +00:00
Make Tx.connect public by exposing enums + tweak DISCONNECT_ON_CONFLICT
This commit is contained in:
parent
f7c09d74ea
commit
6cdfad43a3
@ -267,7 +267,7 @@ public class TransactionInput extends ChildMessage implements Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ConnectionResult {
|
public enum ConnectionResult {
|
||||||
NO_SUCH_TX,
|
NO_SUCH_TX,
|
||||||
ALREADY_SPENT,
|
ALREADY_SPENT,
|
||||||
SUCCESS
|
SUCCESS
|
||||||
@ -288,7 +288,7 @@ public class TransactionInput extends ChildMessage implements Serializable {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ConnectMode {
|
public enum ConnectMode {
|
||||||
DISCONNECT_ON_CONFLICT,
|
DISCONNECT_ON_CONFLICT,
|
||||||
ABORT_ON_CONFLICT
|
ABORT_ON_CONFLICT
|
||||||
}
|
}
|
||||||
@ -320,7 +320,7 @@ public class TransactionInput extends ChildMessage implements Serializable {
|
|||||||
* @return NO_SUCH_TX if transaction is not the prevtx, ALREADY_SPENT if there was a conflict, SUCCESS if not.
|
* @return NO_SUCH_TX if transaction is not the prevtx, ALREADY_SPENT if there was a conflict, SUCCESS if not.
|
||||||
*/
|
*/
|
||||||
public ConnectionResult connect(Transaction transaction, ConnectMode mode) {
|
public ConnectionResult connect(Transaction transaction, ConnectMode mode) {
|
||||||
if (!transaction.getHash().equals(outpoint.getHash()) && mode != ConnectMode.DISCONNECT_ON_CONFLICT)
|
if (!transaction.getHash().equals(outpoint.getHash()))
|
||||||
return ConnectionResult.NO_SUCH_TX;
|
return ConnectionResult.NO_SUCH_TX;
|
||||||
checkElementIndex((int) outpoint.getIndex(), transaction.getOutputs().size(), "Corrupt transaction");
|
checkElementIndex((int) outpoint.getIndex(), transaction.getOutputs().size(), "Corrupt transaction");
|
||||||
TransactionOutput out = transaction.getOutput((int) outpoint.getIndex());
|
TransactionOutput out = transaction.getOutput((int) outpoint.getIndex());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user