aboutsummaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h34
1 files changed, 24 insertions, 10 deletions
diff --git a/src/main.h b/src/main.h
index 76de47071e..b56a4a5e19 100644
--- a/src/main.h
+++ b/src/main.h
@@ -17,7 +17,6 @@
#include <list>
-class CWallet;
class CBlock;
class CBlockIndex;
class CKeyItem;
@@ -81,8 +80,6 @@ extern uint64 nLastBlockTx;
extern uint64 nLastBlockSize;
extern const std::string strMessageMagic;
extern int64 nTimeBestReceived;
-extern CCriticalSection cs_setpwalletRegistered;
-extern std::set<CWallet*> setpwalletRegistered;
extern bool fImporting;
extern bool fReindex;
extern bool fBenchmark;
@@ -108,17 +105,18 @@ class CCoinsView;
class CCoinsViewCache;
class CScriptCheck;
class CValidationState;
+class CWalletInterface;
struct CBlockTemplate;
/** Register a wallet to receive updates from core */
-void RegisterWallet(CWallet* pwalletIn);
+void RegisterWallet(CWalletInterface* pwalletIn);
/** Unregister a wallet from core */
-void UnregisterWallet(CWallet* pwalletIn);
+void UnregisterWallet(CWalletInterface* pwalletIn);
/** Unregister all wallets from core */
void UnregisterAllWallets();
/** Push an updated transaction to all registered wallets */
-void SyncWithWallets(const uint256 &hash, const CTransaction& tx, const CBlock* pblock = NULL, bool fUpdate = false);
+void SyncWithWallets(const uint256 &hash, const CTransaction& tx, const CBlock* pblock = NULL);
/** Register with a network node to receive its signals */
void RegisterNodeSignals(CNodeSignals& nodeSignals);
@@ -190,9 +188,6 @@ bool AbortNode(const std::string &msg);
-
-bool GetWalletFile(CWallet* pwallet, std::string &strWalletFileOut);
-
struct CDiskBlockPos
{
int nFile;
@@ -946,13 +941,15 @@ private:
MODE_ERROR, // run-time error
} mode;
int nDoS;
+ bool corruptionPossible;
public:
CValidationState() : mode(MODE_VALID), nDoS(0) {}
- bool DoS(int level, bool ret = false) {
+ bool DoS(int level, bool ret = false, bool corruptionIn = false) {
if (mode == MODE_ERROR)
return ret;
nDoS += level;
mode = MODE_INVALID;
+ corruptionPossible = corruptionIn;
return ret;
}
bool Invalid(bool ret = false) {
@@ -982,6 +979,9 @@ public:
}
return false;
}
+ bool CorruptionPossible() {
+ return corruptionPossible;
+ }
};
/** An in-memory indexed chain of blocks. */
@@ -1256,4 +1256,18 @@ public:
)
};
+
+class CWalletInterface {
+protected:
+ virtual void SyncTransaction(const uint256 &hash, const CTransaction &tx, const CBlock *pblock) =0;
+ virtual void EraseFromWallet(const uint256 &hash) =0;
+ virtual void SetBestChain(const CBlockLocator &locator) =0;
+ virtual void UpdatedTransaction(const uint256 &hash) =0;
+ virtual void Inventory(const uint256 &hash) =0;
+ virtual void ResendWalletTransactions() =0;
+ friend void ::RegisterWallet(CWalletInterface*);
+ friend void ::UnregisterWallet(CWalletInterface*);
+ friend void ::UnregisterAllWallets();
+};
+
#endif