mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
Merge #12276: Remove duplicate mapWallet lookups
039425c
[wallet] Remove duplicate mapWallet lookups (João Barbosa)
Pull request description:
Tree-SHA512: 8075925d2adb64737c691e988d74a37bc326711aaee2c37327361679c051f219fa500e14cbcdb6a169352bcdbab160e11df4276b2657e19e12908ee2d4444d30
This commit is contained in:
commit
7936446268
@ -531,14 +531,11 @@ void CWallet::SyncMetaData(std::pair<TxSpends::iterator, TxSpends::iterator> ran
|
||||
|
||||
int nMinOrderPos = std::numeric_limits<int>::max();
|
||||
const CWalletTx* copyFrom = nullptr;
|
||||
for (TxSpends::iterator it = range.first; it != range.second; ++it)
|
||||
{
|
||||
const uint256& hash = it->second;
|
||||
int n = mapWallet[hash].nOrderPos;
|
||||
if (n < nMinOrderPos)
|
||||
{
|
||||
nMinOrderPos = n;
|
||||
copyFrom = &mapWallet[hash];
|
||||
for (TxSpends::iterator it = range.first; it != range.second; ++it) {
|
||||
const CWalletTx* wtx = &mapWallet[it->second];
|
||||
if (wtx->nOrderPos < nMinOrderPos) {
|
||||
nMinOrderPos = wtx->nOrderPos;;
|
||||
copyFrom = wtx;
|
||||
}
|
||||
}
|
||||
|
||||
@ -988,9 +985,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose)
|
||||
bool CWallet::LoadToWallet(const CWalletTx& wtxIn)
|
||||
{
|
||||
uint256 hash = wtxIn.GetHash();
|
||||
|
||||
mapWallet[hash] = wtxIn;
|
||||
CWalletTx& wtx = mapWallet[hash];
|
||||
CWalletTx& wtx = mapWallet.emplace(hash, wtxIn).first->second;
|
||||
wtx.BindWallet(this);
|
||||
wtxOrdered.insert(std::make_pair(wtx.nOrderPos, TxPair(&wtx, nullptr)));
|
||||
AddToSpends(hash);
|
||||
|
Loading…
Reference in New Issue
Block a user