Skip to content

Commit 98cf19c

Browse files
committed
wallet: refactor: avoid duplicate lookup on mapValue["timesmart"]
Also, use a named cast for converting the atoi64() result into an unsigned int type.
1 parent 973d8ba commit 98cf19c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/wallet/transaction.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ class CWalletTx
217217

218218
const auto it_op = mapValue.find("n");
219219
nOrderPos = (it_op != mapValue.end()) ? atoi64(it_op->second) : -1;
220-
nTimeSmart = mapValue.count("timesmart") ? (unsigned int)atoi64(mapValue["timesmart"]) : 0;
220+
const auto it_ts = mapValue.find("timesmart");
221+
nTimeSmart = (it_ts != mapValue.end()) ? static_cast<unsigned int>(atoi64(it_ts->second)) : 0;
221222

222223
mapValue.erase("fromaccount");
223224
mapValue.erase("spent");

0 commit comments

Comments
 (0)