is locktime enabled check

This commit is contained in:
Craig Raw 2020-04-02 14:00:47 +02:00
parent 8c4e6f4ac8
commit 1a0880dde7
2 changed files with 14 additions and 0 deletions

View file

@ -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) {

View file

@ -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;