@@ -97,16 +97,6 @@ void UnregisterAllWallets()
9797 setpwalletRegistered.clear ();
9898}
9999
100- // get the wallet transaction with the given hash (if it exists)
101- bool static GetTransaction (const uint256& hashTx, CWalletTx& wtx)
102- {
103- LOCK (cs_setpwalletRegistered);
104- BOOST_FOREACH (CWallet* pwallet, setpwalletRegistered)
105- if (pwallet->GetTransaction (hashTx,wtx))
106- return true ;
107- return false ;
108- }
109-
110100// erases transaction with the given hash from all wallets
111101void static EraseFromWallets (uint256 hash)
112102{
@@ -1750,12 +1740,12 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex
17501740 const CTransaction &tx = block.vtx [i];
17511741 uint256 hash = tx.GetHash ();
17521742
1753- // Check that all outputs are available and match the outputs in the block itself
1754- // exactly. Note that transactions with only provably unspendable outputs won't
1755- // have outputs available even in the block itself, so we handle that case
1756- // specially with outsEmpty.
1757- CCoins outsEmpty;
1758- CCoins &outs = view.HaveCoins (hash) ? view. GetCoins (hash) : outsEmpty ;
1743+ // check that all outputs are available
1744+ if (!view. HaveCoins (hash)) {
1745+ fClean = fClean && error ( " DisconnectBlock() : outputs still spent? database corrupted " );
1746+ view. SetCoins (hash, CCoins ());
1747+ }
1748+ CCoins &outs = view.GetCoins (hash);
17591749 outs.ClearUnspendable ();
17601750
17611751 CCoins outsBlock = CCoins (tx, pindex->nHeight );
@@ -2355,7 +2345,7 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo
23552345 uniqueTx.insert (block.GetTxHash (i));
23562346 }
23572347 if (uniqueTx.size () != block.vtx .size ())
2358- return state.DoS (100 , error (" CheckBlock() : duplicate transaction" ), true );
2348+ return state.DoS (100 , error (" CheckBlock() : duplicate transaction" ));
23592349
23602350 unsigned int nSigOps = 0 ;
23612351 BOOST_FOREACH (const CTransaction& tx, block.vtx )
@@ -3783,7 +3773,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
37833773 LOCK (cs_main);
37843774
37853775 CValidationState state;
3786- if (ProcessBlock (state, pfrom, &block) || state. CorruptionPossible () )
3776+ if (ProcessBlock (state, pfrom, &block))
37873777 mapAlreadyAskedFor.erase (inv);
37883778 int nDoS = 0 ;
37893779 if (state.IsInvalid (nDoS))
@@ -3814,10 +3804,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
38143804 if ((pfrom->pfilter && pfrom->pfilter ->IsRelevantAndUpdate (mempool.lookup (hash), hash)) ||
38153805 (!pfrom->pfilter ))
38163806 vInv.push_back (inv);
3817- if (vInv.size () == MAX_INV_SZ) {
3818- pfrom->PushMessage (" inv" , vInv);
3819- vInv.clear ();
3820- }
3807+ if (vInv.size () == MAX_INV_SZ)
3808+ break ;
38213809 }
38223810 if (vInv.size () > 0 )
38233811 pfrom->PushMessage (" inv" , vInv);
@@ -4243,15 +4231,6 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
42434231 hashRand = Hash (BEGIN (hashRand), END (hashRand));
42444232 bool fTrickleWait = ((hashRand & 3 ) != 0 );
42454233
4246- // always trickle our own transactions
4247- if (!fTrickleWait )
4248- {
4249- CWalletTx wtx;
4250- if (GetTransaction (inv.hash , wtx))
4251- if (wtx.fFromMe )
4252- fTrickleWait = true ;
4253- }
4254-
42554234 if (fTrickleWait )
42564235 {
42574236 vInvWait.push_back (inv);
0 commit comments