aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2011-07-09 10:26:46 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2011-07-09 10:30:23 +0200
commit2eace48d9a50e5393f3627bcd0614ed9b262794a (patch)
treecf27980d722561065041842ef028c2dc9337c1cf
parent460cd40aa51a5367c361ebb32c2a2d39cdd08195 (diff)
remove magic number: change threshold for nLockTime to constant
-rw-r--r--src/main.h4
-rw-r--r--src/qt/transactionrecord.cpp2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/main.h b/src/main.h
index aa74ac5ab3..124c7c2671 100644
--- a/src/main.h
+++ b/src/main.h
@@ -37,6 +37,8 @@ static const int64 MIN_RELAY_TX_FEE = 10000;
static const int64 MAX_MONEY = 21000000 * COIN;
inline bool MoneyRange(int64 nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
static const int COINBASE_MATURITY = 100;
+// Threshold for nLockTime: below this value it is interpreted as block number, otherwise as UNIX timestamp.
+static const int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 1985 UTC
#ifdef USE_UPNP
static const int fHaveUPnP = true;
#else
@@ -441,7 +443,7 @@ public:
nBlockHeight = nBestHeight;
if (nBlockTime == 0)
nBlockTime = GetAdjustedTime();
- if ((int64)nLockTime < (nLockTime < 500000000 ? (int64)nBlockHeight : nBlockTime))
+ if ((int64)nLockTime < (nLockTime < LOCKTIME_THRESHOLD ? (int64)nBlockHeight : nBlockTime))
return true;
BOOST_FOREACH(const CTxIn& txin, vin)
if (!txin.IsFinal())
diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp
index 1b527bc7d3..c74b48bd61 100644
--- a/src/qt/transactionrecord.cpp
+++ b/src/qt/transactionrecord.cpp
@@ -195,7 +195,7 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
if (!wtx.IsFinal())
{
- if (wtx.nLockTime < 500000000)
+ if (wtx.nLockTime < LOCKTIME_THRESHOLD)
{
status.status = TransactionStatus::OpenUntilBlock;
status.open_for = nBestHeight - wtx.nLockTime;