Browse Source

Remove SyncWithWallets wrapper function

0.14
Matt Corallo 8 years ago
parent
commit
7565e03b96
  1. 8
      src/main.cpp
  2. 4
      src/validationinterface.cpp
  3. 4
      src/validationinterface.h

8
src/main.cpp

@ -1542,7 +1542,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
} }
} }
SyncWithWallets(tx, NULL); GetMainSignals().SyncTransaction(tx, NULL, CMainSignals::SYNC_TRANSACTION_NOT_IN_BLOCK);
return true; return true;
} }
@ -2775,7 +2775,7 @@ bool static DisconnectTip(CValidationState& state, const CChainParams& chainpara
// Let wallets know transactions went from 1-confirmed to // Let wallets know transactions went from 1-confirmed to
// 0-confirmed or conflicted: // 0-confirmed or conflicted:
BOOST_FOREACH(const CTransaction &tx, block.vtx) { BOOST_FOREACH(const CTransaction &tx, block.vtx) {
SyncWithWallets(tx, pindexDelete->pprev); GetMainSignals().SyncTransaction(tx, pindexDelete->pprev, CMainSignals::SYNC_TRANSACTION_NOT_IN_BLOCK);
} }
return true; return true;
} }
@ -3059,11 +3059,11 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
// while _not_ holding the cs_main lock // while _not_ holding the cs_main lock
BOOST_FOREACH(const CTransaction &tx, txConflicted) BOOST_FOREACH(const CTransaction &tx, txConflicted)
{ {
SyncWithWallets(tx, pindexNewTip); GetMainSignals().SyncTransaction(tx, pindexNewTip, CMainSignals::SYNC_TRANSACTION_NOT_IN_BLOCK);
} }
// ... and about transactions that got confirmed: // ... and about transactions that got confirmed:
for(unsigned int i = 0; i < txChanged.size(); i++) for(unsigned int i = 0; i < txChanged.size(); i++)
SyncWithWallets(std::get<0>(txChanged[i]), std::get<1>(txChanged[i]), std::get<2>(txChanged[i])); GetMainSignals().SyncTransaction(std::get<0>(txChanged[i]), std::get<1>(txChanged[i]), std::get<2>(txChanged[i]));
// Notify external listeners about the new tip. // Notify external listeners about the new tip.
GetMainSignals().UpdatedBlockTip(pindexNewTip, pindexFork, fInitialDownload); GetMainSignals().UpdatedBlockTip(pindexNewTip, pindexFork, fInitialDownload);

4
src/validationinterface.cpp

@ -47,7 +47,3 @@ void UnregisterAllValidationInterfaces() {
g_signals.SyncTransaction.disconnect_all_slots(); g_signals.SyncTransaction.disconnect_all_slots();
g_signals.UpdatedBlockTip.disconnect_all_slots(); g_signals.UpdatedBlockTip.disconnect_all_slots();
} }
void SyncWithWallets(const CTransaction &tx, const CBlockIndex *pindex, int posInBlock) {
g_signals.SyncTransaction(tx, pindex, posInBlock);
}

4
src/validationinterface.h

@ -28,8 +28,6 @@ void RegisterValidationInterface(CValidationInterface* pwalletIn);
void UnregisterValidationInterface(CValidationInterface* pwalletIn); void UnregisterValidationInterface(CValidationInterface* pwalletIn);
/** Unregister all wallets from core */ /** Unregister all wallets from core */
void UnregisterAllValidationInterfaces(); void UnregisterAllValidationInterfaces();
/** Push an updated transaction to all registered wallets */
void SyncWithWallets(const CTransaction& tx, const CBlockIndex *pindex, int posInBlock = -1);
class CValidationInterface { class CValidationInterface {
protected: protected:
@ -50,6 +48,8 @@ protected:
struct CMainSignals { struct CMainSignals {
/** Notifies listeners of updated block chain tip */ /** Notifies listeners of updated block chain tip */
boost::signals2::signal<void (const CBlockIndex *, const CBlockIndex *, bool fInitialDownload)> UpdatedBlockTip; boost::signals2::signal<void (const CBlockIndex *, const CBlockIndex *, bool fInitialDownload)> UpdatedBlockTip;
/** A posInBlock value for SyncTransaction which indicates the transaction was conflicted, disconnected, or not in a block */
static const int SYNC_TRANSACTION_NOT_IN_BLOCK = -1;
/** Notifies listeners of updated transaction data (transaction, and optionally the block it is found in. */ /** Notifies listeners of updated transaction data (transaction, and optionally the block it is found in. */
boost::signals2::signal<void (const CTransaction &, const CBlockIndex *pindex, int posInBlock)> SyncTransaction; boost::signals2::signal<void (const CTransaction &, const CBlockIndex *pindex, int posInBlock)> SyncTransaction;
/** Notifies listeners of an updated transaction without new data (for now: a coinbase potentially becoming visible). */ /** Notifies listeners of an updated transaction without new data (for now: a coinbase potentially becoming visible). */

Loading…
Cancel
Save