diff --git a/src/main/java/com/sparrowwallet/drongo/protocol/Transaction.java b/src/main/java/com/sparrowwallet/drongo/protocol/Transaction.java index cbe537b..7445aed 100644 --- a/src/main/java/com/sparrowwallet/drongo/protocol/Transaction.java +++ b/src/main/java/com/sparrowwallet/drongo/protocol/Transaction.java @@ -53,6 +53,18 @@ public class Transaction extends TransactionPart { this.lockTime = lockTime; } + public boolean isLockTimeEnabled() { + if(lockTime == 0) return false; + + for(TransactionInput input : inputs) { + if(input.getSequenceNumber() != TransactionInput.SEQUENCE_LOCKTIME_DISABLED) { + return true; + } + } + + return false; + } + public Sha256Hash getTxId() { if (cachedTxId == null) { if (!hasWitnesses() && cachedWTxId != null) { diff --git a/src/main/java/com/sparrowwallet/drongo/protocol/TransactionInput.java b/src/main/java/com/sparrowwallet/drongo/protocol/TransactionInput.java index 768050c..040c0b1 100644 --- a/src/main/java/com/sparrowwallet/drongo/protocol/TransactionInput.java +++ b/src/main/java/com/sparrowwallet/drongo/protocol/TransactionInput.java @@ -6,6 +6,8 @@ import java.io.IOException; import java.io.OutputStream; public class TransactionInput extends TransactionPart { + public static final long SEQUENCE_LOCKTIME_DISABLED = 0xFFFFFFFF; + // Allows for altering transactions after they were broadcast. Values below NO_SEQUENCE-1 mean it can be altered. private long sequence;