diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2013-10-29 18:01:57 -0700 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2013-10-29 18:01:57 -0700 |
commit | e13934c94eb6e95c21e04b92c4b0775b2bded67e (patch) | |
tree | c4ed663519a61e6d3a77478c25381ede579f129c /src/main.h | |
parent | cde10602a6e4cfbf10126ea9bcefb6b79175818b (diff) | |
parent | 722fa283d04dfe9c70418e69535a08eea06b4377 (diff) |
Merge pull request #3115 from sipa/walletmain
Interaction cleanups between main and wallet
Diffstat (limited to 'src/main.h')
-rw-r--r-- | src/main.h | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/main.h b/src/main.h index 2a67747b47..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; @@ -1261,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 |