mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +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();
|
int nMinOrderPos = std::numeric_limits<int>::max();
|
||||||
const CWalletTx* copyFrom = nullptr;
|
const CWalletTx* copyFrom = nullptr;
|
||||||
for (TxSpends::iterator it = range.first; it != range.second; ++it)
|
for (TxSpends::iterator it = range.first; it != range.second; ++it) {
|
||||||
{
|
const CWalletTx* wtx = &mapWallet[it->second];
|
||||||
const uint256& hash = it->second;
|
if (wtx->nOrderPos < nMinOrderPos) {
|
||||||
int n = mapWallet[hash].nOrderPos;
|
nMinOrderPos = wtx->nOrderPos;;
|
||||||
if (n < nMinOrderPos)
|
copyFrom = wtx;
|
||||||
{
|
|
||||||
nMinOrderPos = n;
|
|
||||||
copyFrom = &mapWallet[hash];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -988,9 +985,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose)
|
|||||||
bool CWallet::LoadToWallet(const CWalletTx& wtxIn)
|
bool CWallet::LoadToWallet(const CWalletTx& wtxIn)
|
||||||
{
|
{
|
||||||
uint256 hash = wtxIn.GetHash();
|
uint256 hash = wtxIn.GetHash();
|
||||||
|
CWalletTx& wtx = mapWallet.emplace(hash, wtxIn).first->second;
|
||||||
mapWallet[hash] = wtxIn;
|
|
||||||
CWalletTx& wtx = mapWallet[hash];
|
|
||||||
wtx.BindWallet(this);
|
wtx.BindWallet(this);
|
||||||
wtxOrdered.insert(std::make_pair(wtx.nOrderPos, TxPair(&wtx, nullptr)));
|
wtxOrdered.insert(std::make_pair(wtx.nOrderPos, TxPair(&wtx, nullptr)));
|
||||||
AddToSpends(hash);
|
AddToSpends(hash);
|
||||||
|
Loading…
Reference in New Issue
Block a user