aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorRussell Yanofsky <[email protected]>2018-10-31 13:00:54 -0400
committerRussell Yanofsky <[email protected]>2018-11-01 12:55:39 -0400
commit535203075e50eedef8f00852328f81f440233278 (patch)
tree3ec4c5e88ab257613142f493333292d3e9f3dda2 /src/script
parentRemove duplicated code (diff)
downloaddiscoin-535203075e50eedef8f00852328f81f440233278.tar.xz
discoin-535203075e50eedef8f00852328f81f440233278.zip
Avoid using numeric_limits for sequence numbers and lock times
Switches to named constants, because numeric_limits calls can be harder to read and less portable. Change was suggested by James O'Beirne <[email protected]> in https://github.com/bitcoin/bitcoin/pull/10973#discussion_r213473620 There are no changes in behavior except on some platforms we don't support (ILP64, IP16L32, I16LP32), where SignalsOptInRBF() and MutateTxAddInput() functions would now work correctly.
Diffstat (limited to 'src/script')
-rw-r--r--src/script/script.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/script/script.h b/src/script/script.h
index 00065a24b..1d8ddba2f 100644
--- a/src/script/script.h
+++ b/src/script/script.h
@@ -38,6 +38,12 @@ static const int MAX_STACK_SIZE = 1000;
// otherwise as UNIX timestamp.
static const unsigned int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 1985 UTC
+// Maximum nLockTime. Since a lock time indicates the last invalid timestamp, a
+// transaction with this lock time will never be valid unless lock time
+// checking is disabled (by setting all input sequence numbers to
+// SEQUENCE_FINAL).
+static const uint32_t LOCKTIME_MAX = 0xFFFFFFFFU;
+
template <typename T>
std::vector<unsigned char> ToByteVector(const T& in)
{