Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 4,062 Lines • ▼ Show 20 Lines | |||||
* | * | ||||
* For more information see CWalletTx::nTimeSmart, | * For more information see CWalletTx::nTimeSmart, | ||||
* https://bitcointalk.org/?topic=54527, or | * https://bitcointalk.org/?topic=54527, or | ||||
* https://github.com/bitcoin/bitcoin/pull/1393. | * https://github.com/bitcoin/bitcoin/pull/1393. | ||||
*/ | */ | ||||
unsigned int CWallet::ComputeTimeSmart(const CWalletTx &wtx) const { | unsigned int CWallet::ComputeTimeSmart(const CWalletTx &wtx) const { | ||||
unsigned int nTimeSmart = wtx.nTimeReceived; | unsigned int nTimeSmart = wtx.nTimeReceived; | ||||
if (!wtx.hashUnset()) { | if (!wtx.hashUnset()) { | ||||
const CBlockIndex *pindex = nullptr; | if (const CBlockIndex *pindex = LookupBlockIndex(wtx.hashBlock)) { | ||||
{ | |||||
LOCK(cs_main); | |||||
pindex = LookupBlockIndex(wtx.hashBlock); | |||||
} | |||||
if (pindex) { | |||||
int64_t latestNow = wtx.nTimeReceived; | int64_t latestNow = wtx.nTimeReceived; | ||||
int64_t latestEntry = 0; | int64_t latestEntry = 0; | ||||
// Tolerate times up to the last timestamp in the wallet not more | // Tolerate times up to the last timestamp in the wallet not more | ||||
// than 5 minutes into the future | // than 5 minutes into the future | ||||
int64_t latestTolerated = latestNow + 300; | int64_t latestTolerated = latestNow + 300; | ||||
const TxItems &txOrdered = wtxOrdered; | const TxItems &txOrdered = wtxOrdered; | ||||
for (auto it = txOrdered.rbegin(); it != txOrdered.rend(); ++it) { | for (auto it = txOrdered.rbegin(); it != txOrdered.rend(); ++it) { | ||||
▲ Show 20 Lines • Show All 394 Lines • Show Last 20 Lines |