Skip to content

Commit cdb8934

Browse files
committed
[validation interface] Remove vtxConflicted from BlockConnected
The wallet now uses TransactionRemovedFromMempool to be notified about conflicted wallet, and no other clients use vtxConflicted.
1 parent 1168394 commit cdb8934

14 files changed

+20
-24
lines changed

src/index/base.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@ bool BaseIndex::Rewind(const CBlockIndex* current_tip, const CBlockIndex* new_ti
188188
return true;
189189
}
190190

191-
void BaseIndex::BlockConnected(const std::shared_ptr<const CBlock>& block, const CBlockIndex* pindex,
192-
const std::vector<CTransactionRef>& txn_conflicted)
191+
void BaseIndex::BlockConnected(const std::shared_ptr<const CBlock>& block, const CBlockIndex* pindex)
193192
{
194193
if (!m_synced) {
195194
return;

src/index/base.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ class BaseIndex : public CValidationInterface
6464
bool Commit();
6565

6666
protected:
67-
void BlockConnected(const std::shared_ptr<const CBlock>& block, const CBlockIndex* pindex,
68-
const std::vector<CTransactionRef>& txn_conflicted) override;
67+
void BlockConnected(const std::shared_ptr<const CBlock>& block, const CBlockIndex* pindex) override;
6968

7069
void ChainStateFlushed(const CBlockLocator& locator) override;
7170

src/interfaces/chain.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,9 @@ class NotificationsHandlerImpl : public Handler, CValidationInterface
172172
{
173173
m_notifications->TransactionRemovedFromMempool(tx);
174174
}
175-
void BlockConnected(const std::shared_ptr<const CBlock>& block,
176-
const CBlockIndex* index,
177-
const std::vector<CTransactionRef>& tx_conflicted) override
175+
void BlockConnected(const std::shared_ptr<const CBlock>& block, const CBlockIndex* index) override
178176
{
179-
m_notifications->BlockConnected(*block, tx_conflicted, index->nHeight);
177+
m_notifications->BlockConnected(*block, index->nHeight);
180178
}
181179
void BlockDisconnected(const std::shared_ptr<const CBlock>& block, const CBlockIndex* index) override
182180
{

src/interfaces/chain.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ class Chain
219219
virtual ~Notifications() {}
220220
virtual void TransactionAddedToMempool(const CTransactionRef& tx) {}
221221
virtual void TransactionRemovedFromMempool(const CTransactionRef& ptx) {}
222-
virtual void BlockConnected(const CBlock& block, const std::vector<CTransactionRef>& tx_conflicted, int height) {}
222+
virtual void BlockConnected(const CBlock& block, int height) {}
223223
virtual void BlockDisconnected(const CBlock& block, int height) {}
224224
virtual void UpdatedBlockTip() {}
225225
virtual void ChainStateFlushed(const CBlockLocator& locator) {}

src/net_processing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,7 @@ PeerLogicValidation::PeerLogicValidation(CConnman* connmanIn, BanMan* banman, CS
11321132
* Evict orphan txn pool entries (EraseOrphanTx) based on a newly connected
11331133
* block. Also save the time of the last tip update.
11341134
*/
1135-
void PeerLogicValidation::BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindex, const std::vector<CTransactionRef>& vtxConflicted)
1135+
void PeerLogicValidation::BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindex)
11361136
{
11371137
{
11381138
LOCK(g_cs_orphans);

src/net_processing.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class PeerLogicValidation final : public CValidationInterface, public NetEventsI
3232
/**
3333
* Overridden from CValidationInterface.
3434
*/
35-
void BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexConnected, const std::vector<CTransactionRef>& vtxConflicted) override;
35+
void BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexConnected) override;
3636
void BlockDisconnected(const std::shared_ptr<const CBlock> &block, const CBlockIndex* pindex) override;
3737
/**
3838
* Overridden from CValidationInterface.

src/test/validation_block_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct TestSubscriber : public CValidationInterface {
4242
BOOST_CHECK_EQUAL(m_expected_tip, pindexNew->GetBlockHash());
4343
}
4444

45-
void BlockConnected(const std::shared_ptr<const CBlock>& block, const CBlockIndex* pindex, const std::vector<CTransactionRef>& txnConflicted) override
45+
void BlockConnected(const std::shared_ptr<const CBlock>& block, const CBlockIndex* pindex) override
4646
{
4747
BOOST_CHECK_EQUAL(m_expected_tip, block->hashPrevBlock);
4848
BOOST_CHECK_EQUAL(m_expected_tip, pindex->pprev->GetBlockHash());

src/validation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2881,7 +2881,7 @@ bool CChainState::ActivateBestChain(BlockValidationState &state, const CChainPar
28812881

28822882
for (const PerBlockConnectTrace& trace : connectTrace.GetBlocksConnected()) {
28832883
assert(trace.pblock && trace.pindex);
2884-
GetMainSignals().BlockConnected(trace.pblock, trace.pindex, trace.conflictedTxs);
2884+
GetMainSignals().BlockConnected(trace.pblock, trace.pindex);
28852885
}
28862886
} while (!m_chain.Tip() || (starting_tip && CBlockIndexWorkComparator()(m_chain.Tip(), starting_tip)));
28872887
if (!blocks_connected) return true;

src/validationinterface.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct ValidationInterfaceConnections {
3333
struct MainSignalsInstance {
3434
boost::signals2::signal<void (const CBlockIndex *, const CBlockIndex *, bool fInitialDownload)> UpdatedBlockTip;
3535
boost::signals2::signal<void (const CTransactionRef &)> TransactionAddedToMempool;
36-
boost::signals2::signal<void (const std::shared_ptr<const CBlock> &, const CBlockIndex *pindex, const std::vector<CTransactionRef>&)> BlockConnected;
36+
boost::signals2::signal<void (const std::shared_ptr<const CBlock> &, const CBlockIndex *pindex)> BlockConnected;
3737
boost::signals2::signal<void (const std::shared_ptr<const CBlock>&, const CBlockIndex* pindex)> BlockDisconnected;
3838
boost::signals2::signal<void (const CTransactionRef &)> TransactionRemovedFromMempool;
3939
boost::signals2::signal<void (const CBlockLocator &)> ChainStateFlushed;
@@ -80,7 +80,7 @@ void RegisterValidationInterface(CValidationInterface* pwalletIn) {
8080
ValidationInterfaceConnections& conns = g_signals.m_internals->m_connMainSignals[pwalletIn];
8181
conns.UpdatedBlockTip = g_signals.m_internals->UpdatedBlockTip.connect(std::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
8282
conns.TransactionAddedToMempool = g_signals.m_internals->TransactionAddedToMempool.connect(std::bind(&CValidationInterface::TransactionAddedToMempool, pwalletIn, std::placeholders::_1));
83-
conns.BlockConnected = g_signals.m_internals->BlockConnected.connect(std::bind(&CValidationInterface::BlockConnected, pwalletIn, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
83+
conns.BlockConnected = g_signals.m_internals->BlockConnected.connect(std::bind(&CValidationInterface::BlockConnected, pwalletIn, std::placeholders::_1, std::placeholders::_2));
8484
conns.BlockDisconnected = g_signals.m_internals->BlockDisconnected.connect(std::bind(&CValidationInterface::BlockDisconnected, pwalletIn, std::placeholders::_1, std::placeholders::_2));
8585
conns.TransactionRemovedFromMempool = g_signals.m_internals->TransactionRemovedFromMempool.connect(std::bind(&CValidationInterface::TransactionRemovedFromMempool, pwalletIn, std::placeholders::_1));
8686
conns.ChainStateFlushed = g_signals.m_internals->ChainStateFlushed.connect(std::bind(&CValidationInterface::ChainStateFlushed, pwalletIn, std::placeholders::_1));
@@ -164,9 +164,9 @@ void CMainSignals::TransactionRemovedFromMempool(const CTransactionRef &ptx) {
164164
ptx->GetWitnessHash().ToString());
165165
}
166166

167-
void CMainSignals::BlockConnected(const std::shared_ptr<const CBlock> &pblock, const CBlockIndex *pindex, const std::shared_ptr<const std::vector<CTransactionRef>>& pvtxConflicted) {
168-
auto event = [pblock, pindex, pvtxConflicted, this] {
169-
m_internals->BlockConnected(pblock, pindex, *pvtxConflicted);
167+
void CMainSignals::BlockConnected(const std::shared_ptr<const CBlock> &pblock, const CBlockIndex *pindex) {
168+
auto event = [pblock, pindex, this] {
169+
m_internals->BlockConnected(pblock, pindex);
170170
};
171171
ENQUEUE_AND_LOG_EVENT(event, "%s: block hash=%s block height=%d", __func__,
172172
pblock->GetHash().ToString(),

src/validationinterface.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class CValidationInterface {
128128
*
129129
* Called on a background thread.
130130
*/
131-
virtual void BlockConnected(const std::shared_ptr<const CBlock> &block, const CBlockIndex *pindex, const std::vector<CTransactionRef> &txnConflicted) {}
131+
virtual void BlockConnected(const std::shared_ptr<const CBlock> &block, const CBlockIndex *pindex) {}
132132
/**
133133
* Notifies listeners of a block being disconnected
134134
*
@@ -192,7 +192,7 @@ class CMainSignals {
192192
void UpdatedBlockTip(const CBlockIndex *, const CBlockIndex *, bool fInitialDownload);
193193
void TransactionAddedToMempool(const CTransactionRef &);
194194
void TransactionRemovedFromMempool(const CTransactionRef &);
195-
void BlockConnected(const std::shared_ptr<const CBlock> &, const CBlockIndex *pindex, const std::shared_ptr<const std::vector<CTransactionRef>> &);
195+
void BlockConnected(const std::shared_ptr<const CBlock> &, const CBlockIndex *pindex);
196196
void BlockDisconnected(const std::shared_ptr<const CBlock> &, const CBlockIndex* pindex);
197197
void ChainStateFlushed(const CBlockLocator &);
198198
void BlockChecked(const CBlock&, const BlockValidationState&);

0 commit comments

Comments
 (0)