aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-09-10 16:30:21 +0200
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-09-12 23:41:32 +0200
commit98cf19ca32785c991628324c313e01349c2986af (patch)
treea60fd81b1a47e7d7b4efa5ee1da87f11200f9efa
parent973d8ba93d0fa00bed4569287e32696300036ab8 (diff)
downloadbitcoin-98cf19ca32785c991628324c313e01349c2986af.tar.xz
wallet: refactor: avoid duplicate lookup on `mapValue["timesmart"]`
Also, use a named cast for converting the atoi64() result into an unsigned int type.
-rw-r--r--src/wallet/transaction.h3
1 files changed, 2 insertions, 1 deletions
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<unsigned int>(atoi64(it_ts->second)) : 0;
mapValue.erase("fromaccount");
mapValue.erase("spent");