From 98cf19ca32785c991628324c313e01349c2986af Mon Sep 17 00:00:00 2001 From: Sebastian Falbesoner Date: Fri, 10 Sep 2021 16:30:21 +0200 Subject: wallet: refactor: avoid duplicate lookup on `mapValue["timesmart"]` Also, use a named cast for converting the atoi64() result into an unsigned int type. --- src/wallet/transaction.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/wallet') diff --git a/src/wallet/transaction.h b/src/wallet/transaction.h index 33cf667cd8..0cd91b9ebe 100644 --- a/src/wallet/transaction.h +++ b/src/wallet/transaction.h @@ -217,7 +217,8 @@ public: const auto it_op = mapValue.find("n"); nOrderPos = (it_op != mapValue.end()) ? atoi64(it_op->second) : -1; - nTimeSmart = mapValue.count("timesmart") ? (unsigned int)atoi64(mapValue["timesmart"]) : 0; + const auto it_ts = mapValue.find("timesmart"); + nTimeSmart = (it_ts != mapValue.end()) ? static_cast(atoi64(it_ts->second)) : 0; mapValue.erase("fromaccount"); mapValue.erase("spent"); -- cgit v1.2.3