Add SYNC_TRANSACTION_NOT_IN_BLOCK constant and fix callers of SyncTransaction

Needed due to out-of-order backporting.
This commit is contained in:
Alexander Block 2017-09-18 18:01:52 +02:00
parent 256b9b77a2
commit f4af44676a
3 changed files with 5 additions and 7 deletions

View File

@ -1014,7 +1014,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
}
if(!fDryRun)
GetMainSignals().SyncTransaction(tx, NULL);
GetMainSignals().SyncTransaction(tx, NULL, CMainSignals::SYNC_TRANSACTION_NOT_IN_BLOCK);
return true;
}
@ -2559,7 +2559,7 @@ bool static DisconnectTip(CValidationState& state, const CChainParams& chainpara
// Let wallets know transactions went from 1-confirmed to
// 0-confirmed or conflicted:
BOOST_FOREACH(const CTransaction &tx, block.vtx) {
GetMainSignals().SyncTransaction(tx, pindexDelete->pprev);
GetMainSignals().SyncTransaction(tx, pindexDelete->pprev, CMainSignals::SYNC_TRANSACTION_NOT_IN_BLOCK);
}
return true;
}
@ -2882,7 +2882,7 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
// while _not_ holding the cs_main lock
BOOST_FOREACH(const CTransaction &tx, txConflicted)
{
GetMainSignals().SyncTransaction(tx, pindexNewTip);
GetMainSignals().SyncTransaction(tx, pindexNewTip, CMainSignals::SYNC_TRANSACTION_NOT_IN_BLOCK);
}
// ... and about transactions that got confirmed:
for(unsigned int i = 0; i < txChanged.size(); i++)

View File

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

View File

@ -55,6 +55,8 @@ struct CMainSignals {
boost::signals2::signal<void (const CBlockIndex *, bool fInitialDownload)> NotifyHeaderTip;
/** Notifies listeners of updated block chain tip */
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. */
boost::signals2::signal<void (const CTransaction &, const CBlockIndex *pindex, int posInBlock)> SyncTransaction;
/** Notifies listeners of an updated transaction lock without new data. */