mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Merge #6480: include the chaintip blockindex in the SyncTransaction signal, add signal UpdateTip()
7d0bf0b
include the chaintip *blockIndex in the SyncTransaction signal (Jonas Schnelli)
This commit is contained in:
parent
a3d1e5eda9
commit
8874b2e0fd
@ -53,7 +53,7 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con
|
|||||||
governance.UpdatedBlockTip(pindexNew, connman);
|
governance.UpdatedBlockTip(pindexNew, connman);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDSNotificationInterface::SyncTransaction(const CTransaction &tx, const CBlock *pblock)
|
void CDSNotificationInterface::SyncTransaction(const CTransaction &tx, const CBlockIndex *pindex, const CBlock *pblock)
|
||||||
{
|
{
|
||||||
instantsend.SyncTransaction(tx, pblock);
|
instantsend.SyncTransaction(tx, pblock);
|
||||||
CPrivateSend::SyncTransaction(tx, pblock);
|
CPrivateSend::SyncTransaction(tx, pblock);
|
||||||
|
@ -21,7 +21,7 @@ protected:
|
|||||||
void AcceptedBlockHeader(const CBlockIndex *pindexNew) override;
|
void AcceptedBlockHeader(const CBlockIndex *pindexNew) override;
|
||||||
void NotifyHeaderTip(const CBlockIndex *pindexNew, bool fInitialDownload) override;
|
void NotifyHeaderTip(const CBlockIndex *pindexNew, bool fInitialDownload) override;
|
||||||
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override;
|
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override;
|
||||||
void SyncTransaction(const CTransaction &tx, const CBlock *pblock) override;
|
void SyncTransaction(const CTransaction &tx, const CBlockIndex *pindex, const CBlock *pblock);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CConnman& connman;
|
CConnman& connman;
|
||||||
|
@ -1015,7 +1015,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!fDryRun)
|
if(!fDryRun)
|
||||||
GetMainSignals().SyncTransaction(tx, NULL);
|
GetMainSignals().SyncTransaction(tx, NULL, NULL);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2524,7 +2524,7 @@ bool static DisconnectTip(CValidationState& state, const Consensus::Params& cons
|
|||||||
// 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) {
|
||||||
GetMainSignals().SyncTransaction(tx, NULL);
|
GetMainSignals().SyncTransaction(tx, pindexDelete->pprev, NULL);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2582,11 +2582,11 @@ bool static ConnectTip(CValidationState& state, const CChainParams& chainparams,
|
|||||||
// Tell wallet about transactions that went from mempool
|
// Tell wallet about transactions that went from mempool
|
||||||
// to conflicted:
|
// to conflicted:
|
||||||
BOOST_FOREACH(const CTransaction &tx, txConflicted) {
|
BOOST_FOREACH(const CTransaction &tx, txConflicted) {
|
||||||
GetMainSignals().SyncTransaction(tx, NULL);
|
GetMainSignals().SyncTransaction(tx, pindexNew, NULL);
|
||||||
}
|
}
|
||||||
// ... and about transactions that got confirmed:
|
// ... and about transactions that got confirmed:
|
||||||
BOOST_FOREACH(const CTransaction &tx, pblock->vtx) {
|
BOOST_FOREACH(const CTransaction &tx, pblock->vtx) {
|
||||||
GetMainSignals().SyncTransaction(tx, pblock);
|
GetMainSignals().SyncTransaction(tx, pindexNew, pblock);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t nTime6 = GetTimeMicros(); nTimePostConnect += nTime6 - nTime5; nTimeTotal += nTime6 - nTime1;
|
int64_t nTime6 = GetTimeMicros(); nTimePostConnect += nTime6 - nTime5; nTimeTotal += nTime6 - nTime1;
|
||||||
|
@ -16,7 +16,7 @@ void RegisterValidationInterface(CValidationInterface* pwalletIn) {
|
|||||||
g_signals.AcceptedBlockHeader.connect(boost::bind(&CValidationInterface::AcceptedBlockHeader, pwalletIn, _1));
|
g_signals.AcceptedBlockHeader.connect(boost::bind(&CValidationInterface::AcceptedBlockHeader, pwalletIn, _1));
|
||||||
g_signals.NotifyHeaderTip.connect(boost::bind(&CValidationInterface::NotifyHeaderTip, pwalletIn, _1, _2));
|
g_signals.NotifyHeaderTip.connect(boost::bind(&CValidationInterface::NotifyHeaderTip, pwalletIn, _1, _2));
|
||||||
g_signals.UpdatedBlockTip.connect(boost::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, _1, _2, _3));
|
g_signals.UpdatedBlockTip.connect(boost::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, _1, _2, _3));
|
||||||
g_signals.SyncTransaction.connect(boost::bind(&CValidationInterface::SyncTransaction, pwalletIn, _1, _2));
|
g_signals.SyncTransaction.connect(boost::bind(&CValidationInterface::SyncTransaction, pwalletIn, _1, _2, _3));
|
||||||
g_signals.NotifyTransactionLock.connect(boost::bind(&CValidationInterface::NotifyTransactionLock, pwalletIn, _1));
|
g_signals.NotifyTransactionLock.connect(boost::bind(&CValidationInterface::NotifyTransactionLock, pwalletIn, _1));
|
||||||
g_signals.UpdatedTransaction.connect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1));
|
g_signals.UpdatedTransaction.connect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1));
|
||||||
g_signals.SetBestChain.connect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1));
|
g_signals.SetBestChain.connect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1));
|
||||||
@ -36,7 +36,7 @@ void UnregisterValidationInterface(CValidationInterface* pwalletIn) {
|
|||||||
g_signals.SetBestChain.disconnect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1));
|
g_signals.SetBestChain.disconnect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1));
|
||||||
g_signals.UpdatedTransaction.disconnect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1));
|
g_signals.UpdatedTransaction.disconnect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1));
|
||||||
g_signals.NotifyTransactionLock.disconnect(boost::bind(&CValidationInterface::NotifyTransactionLock, pwalletIn, _1));
|
g_signals.NotifyTransactionLock.disconnect(boost::bind(&CValidationInterface::NotifyTransactionLock, pwalletIn, _1));
|
||||||
g_signals.SyncTransaction.disconnect(boost::bind(&CValidationInterface::SyncTransaction, pwalletIn, _1, _2));
|
g_signals.SyncTransaction.disconnect(boost::bind(&CValidationInterface::SyncTransaction, pwalletIn, _1, _2, _3));
|
||||||
g_signals.UpdatedBlockTip.disconnect(boost::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, _1, _2, _3));
|
g_signals.UpdatedBlockTip.disconnect(boost::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, _1, _2, _3));
|
||||||
g_signals.NotifyHeaderTip.disconnect(boost::bind(&CValidationInterface::NotifyHeaderTip, pwalletIn, _1, _2));
|
g_signals.NotifyHeaderTip.disconnect(boost::bind(&CValidationInterface::NotifyHeaderTip, pwalletIn, _1, _2));
|
||||||
g_signals.AcceptedBlockHeader.disconnect(boost::bind(&CValidationInterface::AcceptedBlockHeader, pwalletIn, _1));
|
g_signals.AcceptedBlockHeader.disconnect(boost::bind(&CValidationInterface::AcceptedBlockHeader, pwalletIn, _1));
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
class CBlock;
|
class CBlock;
|
||||||
|
class CBlockIndex;
|
||||||
struct CBlockLocator;
|
struct CBlockLocator;
|
||||||
class CBlockIndex;
|
class CBlockIndex;
|
||||||
class CConnman;
|
class CConnman;
|
||||||
@ -33,7 +34,7 @@ protected:
|
|||||||
virtual void AcceptedBlockHeader(const CBlockIndex *pindexNew) {}
|
virtual void AcceptedBlockHeader(const CBlockIndex *pindexNew) {}
|
||||||
virtual void NotifyHeaderTip(const CBlockIndex *pindexNew, bool fInitialDownload) {}
|
virtual void NotifyHeaderTip(const CBlockIndex *pindexNew, bool fInitialDownload) {}
|
||||||
virtual void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) {}
|
virtual void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) {}
|
||||||
virtual void SyncTransaction(const CTransaction &tx, const CBlock *pblock) {}
|
virtual void SyncTransaction(const CTransaction &tx, const CBlockIndex *pindex, const CBlock *pblock) {}
|
||||||
virtual void NotifyTransactionLock(const CTransaction &tx) {}
|
virtual void NotifyTransactionLock(const CTransaction &tx) {}
|
||||||
virtual void SetBestChain(const CBlockLocator &locator) {}
|
virtual void SetBestChain(const CBlockLocator &locator) {}
|
||||||
virtual bool UpdatedTransaction(const uint256 &hash) { return false;}
|
virtual bool UpdatedTransaction(const uint256 &hash) { return false;}
|
||||||
@ -55,7 +56,7 @@ 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;
|
||||||
/** 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 CBlock *)> SyncTransaction;
|
boost::signals2::signal<void (const CTransaction &, const CBlockIndex *pindex, const CBlock *)> SyncTransaction;
|
||||||
/** Notifies listeners of an updated transaction lock without new data. */
|
/** Notifies listeners of an updated transaction lock without new data. */
|
||||||
boost::signals2::signal<void (const CTransaction &)> NotifyTransactionLock;
|
boost::signals2::signal<void (const CTransaction &)> NotifyTransactionLock;
|
||||||
/** 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). */
|
||||||
|
@ -1185,7 +1185,7 @@ void CWallet::MarkConflicted(const uint256& hashBlock, const uint256& hashTx)
|
|||||||
fAnonymizableTallyCachedNonDenom = false;
|
fAnonymizableTallyCachedNonDenom = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallet::SyncTransaction(const CTransaction& tx, const CBlock* pblock)
|
void CWallet::SyncTransaction(const CTransaction& tx, const CBlockIndex *pindex, const CBlock* pblock)
|
||||||
{
|
{
|
||||||
LOCK2(cs_main, cs_wallet);
|
LOCK2(cs_main, cs_wallet);
|
||||||
|
|
||||||
|
@ -850,7 +850,7 @@ public:
|
|||||||
|
|
||||||
void MarkDirty();
|
void MarkDirty();
|
||||||
bool AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet, CWalletDB* pwalletdb);
|
bool AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet, CWalletDB* pwalletdb);
|
||||||
void SyncTransaction(const CTransaction& tx, const CBlock* pblock);
|
void SyncTransaction(const CTransaction& tx, const CBlockIndex *pindex, const CBlock* pblock);
|
||||||
bool AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate);
|
bool AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate);
|
||||||
int ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate = false);
|
int ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate = false);
|
||||||
void ReacceptWalletTransactions();
|
void ReacceptWalletTransactions();
|
||||||
|
@ -146,7 +146,7 @@ void CZMQNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CZMQNotificationInterface::SyncTransaction(const CTransaction &tx, const CBlock *pblock)
|
void CZMQNotificationInterface::SyncTransaction(const CTransaction& tx, const CBlockIndex* pindex, const CBlock* pblock)
|
||||||
{
|
{
|
||||||
for (std::list<CZMQAbstractNotifier*>::iterator i = notifiers.begin(); i!=notifiers.end(); )
|
for (std::list<CZMQAbstractNotifier*>::iterator i = notifiers.begin(); i!=notifiers.end(); )
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,7 @@ protected:
|
|||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
// CValidationInterface
|
// CValidationInterface
|
||||||
void SyncTransaction(const CTransaction &tx, const CBlock *pblock);
|
void SyncTransaction(const CTransaction& tx, const CBlockIndex *pindex, const CBlock* pblock);
|
||||||
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload);
|
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload);
|
||||||
void NotifyTransactionLock(const CTransaction &tx);
|
void NotifyTransactionLock(const CTransaction &tx);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user