fix PING attack [CVE-2019-17048]
This commit is contained in:
@@ -1841,7 +1841,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
|
||||
|
||||
void CWallet::SyncTransaction(const CTransaction& tx, const CBlock* pblock)
|
||||
{
|
||||
LOCK2(cs_main, cs_wallet);
|
||||
LOCK(cs_wallet);
|
||||
if (!AddToWalletIfInvolvingMe(tx, pblock, true))
|
||||
return; // Not one of ours
|
||||
|
||||
@@ -4830,9 +4830,8 @@ CWalletKey::CWalletKey(int64_t nExpires)
|
||||
nTimeExpires = nExpires;
|
||||
}
|
||||
|
||||
int CMerkleTx::SetMerkleBranch(const CBlock& block)
|
||||
void CMerkleTx::SetMerkleBranch(const CBlock& block)
|
||||
{
|
||||
AssertLockHeld(cs_main);
|
||||
CBlock blockTmp;
|
||||
|
||||
// Update the tx's hashBlock
|
||||
@@ -4847,21 +4846,10 @@ int CMerkleTx::SetMerkleBranch(const CBlock& block)
|
||||
vMerkleBranch.clear();
|
||||
nIndex = -1;
|
||||
LogPrintf("ERROR: SetMerkleBranch(): couldn't find tx in block\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Fill in merkle branch
|
||||
vMerkleBranch = block.GetMerkleBranch(nIndex);
|
||||
|
||||
// Is the tx in a block that's in the main chain
|
||||
BlockMap::iterator mi = mapBlockIndex.find(hashBlock);
|
||||
if (mi == mapBlockIndex.end())
|
||||
return 0;
|
||||
const CBlockIndex* pindex = (*mi).second;
|
||||
if (!pindex || !chainActive.Contains(pindex))
|
||||
return 0;
|
||||
|
||||
return chainActive.Height() - pindex->GetHeight() + 1;
|
||||
}
|
||||
|
||||
int CMerkleTx::GetDepthInMainChainINTERNAL(const CBlockIndex* &pindexRet) const
|
||||
|
||||
Reference in New Issue
Block a user