wallet: refactor: avoid duplicate lookup on mapValue["timesmart"]

Also, use a named cast for converting the atoi64() result into an
unsigned int type.
This commit is contained in:
Sebastian Falbesoner 2021-09-10 16:30:21 +02:00
parent 973d8ba93d
commit 98cf19ca32

View file

@ -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");