From 235312358016ddfed75d3b9b6cf4149c96affdf9 Mon Sep 17 00:00:00 2001 From: miguel Date: Thu, 18 Jul 2013 14:51:51 -0300 Subject: [PATCH] remove vtxPrev --- src/main.cpp | 10 --------- src/main.h | 3 ++- src/wallet.cpp | 55 +------------------------------------------------- src/wallet.h | 32 ----------------------------- 4 files changed, 3 insertions(+), 97 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index d8c3b3a5..06c11796 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -724,16 +724,6 @@ bool CWalletTx::AcceptWalletTransaction() { { LOCK(mempool.cs); - // Add previous supporting transactions first - BOOST_FOREACH(CMerkleTx& tx, vtxPrev) - { - if (!tx.IsSpamMessage()) - { - uint256 hash = tx.GetHash(); - if (!mempool.exists(hash) && pcoinsTip->HaveCoins(tx.GetUsernameHash())) - tx.AcceptToMemoryPool(false); - } - } return AcceptToMemoryPool(false); } return false; diff --git a/src/main.h b/src/main.h index af5f4693..decfbedb 100644 --- a/src/main.h +++ b/src/main.h @@ -30,7 +30,8 @@ static const unsigned int MAX_BLOCK_SIZE = 1000000; /** The maximum size for mined blocks */ static const unsigned int MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE/2; /** The maximum size for transactions we're willing to relay/mine */ -static const unsigned int MAX_STANDARD_TX_SIZE = MAX_BLOCK_SIZE_GEN/5; +//static const unsigned int MAX_STANDARD_TX_SIZE = MAX_BLOCK_SIZE_GEN/5; +static const unsigned int MAX_STANDARD_TX_SIZE = (140+16+512+32); //msg+user+key+spare /** The maximum allowed number of signature check operations in a block (network rule) */ static const unsigned int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50; /** The maximum number of orphan transactions kept in memory */ diff --git a/src/wallet.cpp b/src/wallet.cpp index bdeb3fa3..f40ba875 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -665,54 +665,7 @@ int CWalletTx::GetRequestCount() const void CWalletTx::AddSupportingTransactions() { - vtxPrev.clear(); - - const int COPY_DEPTH = 3; - if (SetMerkleBranch() < COPY_DEPTH) - { - vector vWorkQueue; - /* - BOOST_FOREACH(const CTxIn& txin, vin) - vWorkQueue.push_back(txin.prevout.hash); - - { - LOCK(pwallet->cs_wallet); - map mapWalletPrev; - set setAlreadyDone; - for (unsigned int i = 0; i < vWorkQueue.size(); i++) - { - uint256 hash = vWorkQueue[i]; - if (setAlreadyDone.count(hash)) - continue; - setAlreadyDone.insert(hash); - - CMerkleTx tx; - map::const_iterator mi = pwallet->mapWallet.find(hash); - if (mi != pwallet->mapWallet.end()) - { - tx = (*mi).second; - BOOST_FOREACH(const CMerkleTx& txWalletPrev, (*mi).second.vtxPrev) - mapWalletPrev[txWalletPrev.GetHash()] = &txWalletPrev; - } - else if (mapWalletPrev.count(hash)) - { - tx = *mapWalletPrev[hash]; - } - - int nDepth = tx.SetMerkleBranch(); - vtxPrev.push_back(tx); - - if (nDepth < COPY_DEPTH) - { - BOOST_FOREACH(const CTxIn& txin, tx.vin) - vWorkQueue.push_back(txin.prevout.hash); - } - } - } - */ - } - - reverse(vtxPrev.begin(), vtxPrev.end()); +// [MF] remove me } bool CWalletTx::WriteToDisk() @@ -810,12 +763,6 @@ void CWallet::ReacceptWalletTransactions() void CWalletTx::RelayWalletTransaction() { - BOOST_FOREACH(const CMerkleTx& tx, vtxPrev) - { - if (!tx.IsSpamMessage()) - if (tx.GetDepthInMainChain() == 0) - RelayTransaction((CTransaction)tx, tx.GetHash()); - } if (!IsSpamMessage()) { if (GetDepthInMainChain() == 0) { diff --git a/src/wallet.h b/src/wallet.h index 66ea5b11..adbb3808 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -381,7 +381,6 @@ private: const CWallet* pwallet; public: - std::vector vtxPrev; mapValue_t mapValue; std::vector > vOrderForm; unsigned int fTimeReceivedIsTxTime; @@ -427,7 +426,6 @@ public: void Init(const CWallet* pwalletIn) { pwallet = pwalletIn; - vtxPrev.clear(); mapValue.clear(); vOrderForm.clear(); fTimeReceivedIsTxTime = false; @@ -476,7 +474,6 @@ public: } nSerSize += SerReadWrite(s, *(CMerkleTx*)this, nType, nVersion,ser_action); - READWRITE(vtxPrev); READWRITE(mapValue); READWRITE(vOrderForm); READWRITE(fTimeReceivedIsTxTime); @@ -662,35 +659,6 @@ public: if (!IsFromMe()) // using wtx's cached debit return false; - // If no confirmations but it's from us, we can still - // consider it confirmed if all dependencies are confirmed - std::map mapPrev; - std::vector vWorkQueue; - vWorkQueue.reserve(vtxPrev.size()+1); - vWorkQueue.push_back(this); - for (unsigned int i = 0; i < vWorkQueue.size(); i++) - { - const CMerkleTx* ptx = vWorkQueue[i]; - - if (ptx->GetDepthInMainChain() >= 1) - continue; - if (!pwallet->IsFromMe(*ptx)) - return false; - - if (mapPrev.empty()) - { - BOOST_FOREACH(const CMerkleTx& tx, vtxPrev) - mapPrev[tx.GetHash()] = &tx; - } -/* - BOOST_FOREACH(const CTxIn& txin, ptx->vin) - { - if (!mapPrev.count(txin.prevout.hash)) - return false; - vWorkQueue.push_back(mapPrev[txin.prevout.hash]); - } - */ - } return true; }