diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-09-10 16:30:21 +0200 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-09-12 23:41:32 +0200 |
commit | 98cf19ca32785c991628324c313e01349c2986af (patch) | |
tree | a60fd81b1a47e7d7b4efa5ee1da87f11200f9efa /src/wallet/transaction.h | |
parent | 973d8ba93d0fa00bed4569287e32696300036ab8 (diff) | |
download | bitcoin-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.
Diffstat (limited to 'src/wallet/transaction.h')
-rw-r--r-- | src/wallet/transaction.h | 3 |
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"); |