aboutsummaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h52
1 files changed, 8 insertions, 44 deletions
diff --git a/src/main.h b/src/main.h
index d568d8e6b8..80972330f3 100644
--- a/src/main.h
+++ b/src/main.h
@@ -12,6 +12,7 @@
#include "core.h"
#include "bignum.h"
#include "sync.h"
+#include "txmempool.h"
#include "net.h"
#include "script.h"
@@ -19,12 +20,11 @@
class CBlock;
class CBlockIndex;
-class CKeyItem;
-class CReserveKey;
-
-class CAddress;
class CInv;
+class CKeyItem;
class CNode;
+class CReserveKey;
+class CWallet;
/** The maximum allowed size for a serialized block, in bytes (network rule) */
static const unsigned int MAX_BLOCK_SIZE = 1000000;
@@ -70,8 +70,8 @@ extern CScript COINBASE_FLAGS;
extern CCriticalSection cs_main;
+extern CTxMemPool mempool;
extern std::map<uint256, CBlockIndex*> mapBlockIndex;
-extern unsigned int nTransactionsUpdated;
extern uint64 nLastBlockTx;
extern uint64 nLastBlockSize;
extern const std::string strMessageMagic;
@@ -175,7 +175,9 @@ bool VerifySignature(const CCoins& txFrom, const CTransaction& txTo, unsigned in
/** Abort with a message */
bool AbortNode(const std::string &msg);
-
+/** (try to) add transaction to memory pool **/
+bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree,
+ bool* pfMissingInputs, bool fRejectInsaneFee=false);
@@ -1029,44 +1031,6 @@ extern CChain chainActive;
-
-
-class CTxMemPool
-{
-public:
- static bool fChecks;
- mutable CCriticalSection cs;
- std::map<uint256, CTransaction> mapTx;
- std::map<COutPoint, CInPoint> mapNextTx;
-
- bool accept(CValidationState &state, const CTransaction &tx, bool fLimitFree, bool* pfMissingInputs, bool fRejectInsaneFee = false);
- bool addUnchecked(const uint256& hash, const CTransaction &tx);
- bool remove(const CTransaction &tx, bool fRecursive = false);
- bool removeConflicts(const CTransaction &tx);
- void clear();
- void queryHashes(std::vector<uint256>& vtxid);
- void pruneSpent(const uint256& hash, CCoins &coins);
- void check(CCoinsViewCache *pcoins) const;
-
- unsigned long size()
- {
- LOCK(cs);
- return mapTx.size();
- }
-
- bool exists(uint256 hash)
- {
- return (mapTx.count(hash) != 0);
- }
-
- CTransaction& lookup(uint256 hash)
- {
- return mapTx[hash];
- }
-};
-
-extern CTxMemPool mempool;
-
struct CCoinsStats
{
int nHeight;