diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-09-10 16:17:03 +0200 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-09-10 16:17:03 +0200 |
commit | 65ed198295e58cf1bc339aa17349b83490872f70 (patch) | |
tree | 10b8812f6bfdd9ec717c59b0b4cbf946b97ccf2b /src/wallet | |
parent | 053a5fc7d912d597cd6dc7376b479420d1eae1c0 (diff) |
wallet: refactor: inline function ReadOrderPos()
Since accounts were removed in commit c9c32e6b844fc79467b7e24c6c916142a0d08484,
this function is only called at one place and thus can be as well inlined. Also,
avoid a duplicate lookup by using the find() method and dereference, instead of
calling count() and operator[].
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/transaction.h | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/wallet/transaction.h b/src/wallet/transaction.h index 094221adf2..997b77c8db 100644 --- a/src/wallet/transaction.h +++ b/src/wallet/transaction.h @@ -20,17 +20,6 @@ typedef std::map<std::string, std::string> mapValue_t; -static inline void ReadOrderPos(int64_t& nOrderPos, mapValue_t& mapValue) -{ - if (!mapValue.count("n")) - { - nOrderPos = -1; // TODO: calculate elsewhere - return; - } - nOrderPos = atoi64(mapValue["n"]); -} - - static inline void WriteOrderPos(const int64_t& nOrderPos, mapValue_t& mapValue) { if (nOrderPos == -1) @@ -232,7 +221,8 @@ public: setConfirmed(); } - ReadOrderPos(nOrderPos, mapValue); + 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; mapValue.erase("fromaccount"); |