Package org.bitcoinj.core
Class LockTime
- java.lang.Object
- 
- org.bitcoinj.core.LockTime
 
- 
- Direct Known Subclasses:
- LockTime.HeightLock,- LockTime.TimeLock
 
 public abstract class LockTime extends java.lang.ObjectWrapper for transaction lock time, specified either as a block heightLockTime.HeightLockor as a timestampLockTime.TimeLock(in seconds since epoch). Both are encoded into the same long "raw value", as used in the Bitcoin protocol. The lock time is said to be "not set" if its raw value is zero (and the zero value will be represented by aLockTime.HeightLockwith value zero.)Instances of this class are immutable and should be treated as Java value-based. 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classLockTime.HeightLockALockTimeinstance that contains a block height.static classLockTime.TimeLockALockTimeinstance that contains a timestamp.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)inthashCode()booleanisSet()The lock time is considered to be set only if its raw value is greater than zero.static LockTimeof(long rawValue)Wrap a raw value (as used in the Bitcoin protocol) into a lock time.static LockTime.HeightLockofBlockHeight(int blockHeight)Wrap a block height into a lock time.static LockTime.TimeLockofTimestamp(java.time.Instant time)Wrap a timestamp into a lock time.longrawValue()Gets the raw value as used in the Bitcoin protocoljava.lang.StringtoString()static LockTimeunset()Construct an unset lock time.
 
- 
- 
- 
Field Detail- 
THRESHOLDpublic static final long THRESHOLD Raw values below this threshold specify a block height, otherwise a timestamp in seconds since epoch. Consider usinglockTime instance of HeightLockorlockTime instance of TimeLockbefore using this constant.- See Also:
- Constant Field Values
 
 - 
valueprotected final long value 
 
- 
 - 
Method Detail- 
ofpublic static LockTime of(long rawValue) Wrap a raw value (as used in the Bitcoin protocol) into a lock time.- Parameters:
- rawValue- raw value to be wrapped
- Returns:
- wrapped value
 
 - 
ofBlockHeightpublic static LockTime.HeightLock ofBlockHeight(int blockHeight) Wrap a block height into a lock time.- Parameters:
- blockHeight- block height to be wrapped
- Returns:
- wrapped block height
 
 - 
ofTimestamppublic static LockTime.TimeLock ofTimestamp(java.time.Instant time) Wrap a timestamp into a lock time.- Parameters:
- time- timestamp to be wrapped
- Returns:
- wrapped timestamp
 
 - 
unsetpublic static LockTime unset() Construct an unset lock time.- Returns:
- unset lock time
 
 - 
rawValuepublic long rawValue() Gets the raw value as used in the Bitcoin protocol- Returns:
- raw value
 
 - 
isSetpublic boolean isSet() The lock time is considered to be set only if its raw value is greater than zero. In other words, it is set if it is either a non-zero block height or a timestamp.- Returns:
- true if lock time is set
 
 - 
equalspublic boolean equals(java.lang.Object o) - Overrides:
- equalsin class- java.lang.Object
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 
- 
 
-