@@ -3478,48 +3478,43 @@ void CWallet::GetKeyBirthTimes(std::map<CTxDestination, int64_t> &mapKeyBirth) c
3478
3478
unsigned int CWallet::ComputeTimeSmart (const CWalletTx& wtx) const
3479
3479
{
3480
3480
unsigned int nTimeSmart = wtx.nTimeReceived ;
3481
- if (!wtx.hashUnset ())
3482
- {
3483
- if (mapBlockIndex.count (wtx.hashBlock ))
3484
- {
3481
+ if (!wtx.hashUnset ()) {
3482
+ if (mapBlockIndex.count (wtx.hashBlock )) {
3485
3483
int64_t latestNow = wtx.nTimeReceived ;
3486
3484
int64_t latestEntry = 0 ;
3487
- {
3488
- // Tolerate times up to the last timestamp in the wallet not more than 5 minutes into the future
3489
- int64_t latestTolerated = latestNow + 300 ;
3490
- const TxItems & txOrdered = wtxOrdered;
3491
- for (TxItems::const_reverse_iterator it = txOrdered.rbegin (); it != txOrdered.rend (); ++it)
3492
- {
3493
- CWalletTx *const pwtx = (*it).second .first ;
3494
- if (pwtx == &wtx)
3495
- continue ;
3496
- CAccountingEntry *const pacentry = (*it).second .second ;
3497
- int64_t nSmartTime;
3498
- if (pwtx)
3499
- {
3500
- nSmartTime = pwtx->nTimeSmart ;
3501
- if (!nSmartTime)
3502
- nSmartTime = pwtx->nTimeReceived ;
3485
+
3486
+ // Tolerate times up to the last timestamp in the wallet not more than 5 minutes into the future
3487
+ int64_t latestTolerated = latestNow + 300 ;
3488
+ const TxItems& txOrdered = wtxOrdered;
3489
+ for (auto it = txOrdered.rbegin (); it != txOrdered.rend (); ++it) {
3490
+ CWalletTx* const pwtx = it->second .first ;
3491
+ if (pwtx == &wtx) {
3492
+ continue ;
3493
+ }
3494
+ CAccountingEntry* const pacentry = it->second .second ;
3495
+ int64_t nSmartTime;
3496
+ if (pwtx) {
3497
+ nSmartTime = pwtx->nTimeSmart ;
3498
+ if (!nSmartTime) {
3499
+ nSmartTime = pwtx->nTimeReceived ;
3503
3500
}
3504
- else
3505
- nSmartTime = pacentry->nTime ;
3506
- if (nSmartTime <= latestTolerated)
3507
- {
3508
- latestEntry = nSmartTime;
3509
- if (nSmartTime > latestNow)
3510
- latestNow = nSmartTime;
3511
- break ;
3501
+ } else {
3502
+ nSmartTime = pacentry->nTime ;
3503
+ }
3504
+ if (nSmartTime <= latestTolerated) {
3505
+ latestEntry = nSmartTime;
3506
+ if (nSmartTime > latestNow) {
3507
+ latestNow = nSmartTime;
3512
3508
}
3509
+ break ;
3513
3510
}
3514
3511
}
3515
3512
3516
3513
int64_t blocktime = mapBlockIndex[wtx.hashBlock ]->GetBlockTime ();
3517
3514
nTimeSmart = std::max (latestEntry, std::min (blocktime, latestNow));
3515
+ } else {
3516
+ LogPrintf (" %s: found %s in block %s not in index\n " , __func__, wtx.GetHash ().ToString (), wtx.hashBlock .ToString ());
3518
3517
}
3519
- else
3520
- LogPrintf (" AddToWallet(): found %s in block %s not in index\n " ,
3521
- wtx.GetHash ().ToString (),
3522
- wtx.hashBlock .ToString ());
3523
3518
}
3524
3519
return nTimeSmart;
3525
3520
}
0 commit comments