Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 1,162 Lines • ▼ Show 20 Lines | bool CWallet::AddToWalletIfInvolvingMe(const CTransaction &tx, | ||||
int posInBlock, bool fUpdate) { | int posInBlock, bool fUpdate) { | ||||
AssertLockHeld(cs_wallet); | AssertLockHeld(cs_wallet); | ||||
if (posInBlock != -1) { | if (posInBlock != -1) { | ||||
for (const CTxIn &txin : tx.vin) { | for (const CTxIn &txin : tx.vin) { | ||||
std::pair<TxSpends::const_iterator, TxSpends::const_iterator> | std::pair<TxSpends::const_iterator, TxSpends::const_iterator> | ||||
range = mapTxSpends.equal_range(txin.prevout); | range = mapTxSpends.equal_range(txin.prevout); | ||||
while (range.first != range.second) { | while (range.first != range.second) { | ||||
if (range.first->second != tx.GetId()) { | if (range.first->second != tx.GetHash()) { | ||||
LogPrintf("Transaction %s (in block %s) conflicts with " | LogPrintf("Transaction %s (in block %s) conflicts with " | ||||
"wallet transaction %s (both spend %s:%i)\n", | "wallet transaction %s (both spend %s:%i)\n", | ||||
tx.GetId().ToString(), | tx.GetHash().ToString(), | ||||
pIndex->GetBlockHash().ToString(), | pIndex->GetBlockHash().ToString(), | ||||
range.first->second.ToString(), | range.first->second.ToString(), | ||||
range.first->first.hash.ToString(), | range.first->first.hash.ToString(), | ||||
range.first->first.n); | range.first->first.n); | ||||
MarkConflicted(pIndex->GetBlockHash(), range.first->second); | MarkConflicted(pIndex->GetBlockHash(), range.first->second); | ||||
} | } | ||||
range.first++; | range.first++; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
bool fExisted = mapWallet.count(tx.GetId()) != 0; | bool fExisted = mapWallet.count(tx.GetHash()) != 0; | ||||
if (fExisted && !fUpdate) { | if (fExisted && !fUpdate) { | ||||
return false; | return false; | ||||
} | } | ||||
if (fExisted || IsMine(tx) || IsFromMe(tx)) { | if (fExisted || IsMine(tx) || IsFromMe(tx)) { | ||||
CWalletTx wtx(this, MakeTransactionRef(tx)); | CWalletTx wtx(this, MakeTransactionRef(tx)); | ||||
// Get merkle branch if transaction was found in a block. | // Get merkle branch if transaction was found in a block. | ||||
▲ Show 20 Lines • Show All 3,294 Lines • Show Last 20 Lines |