Skip to content

Commit 65ecf24

Browse files
committed
Merge bitcoin/bitcoin#26752: wallet: Remove mempool_sequence from interface methods
55696a0 wallet: remove `mempool_sequence` from `transactionRemovedFromMempool` (w0xlt) bf19069 wallet: remove `mempool_sequence` from `transactionAddedToMempool` (w0xlt) Pull request description: This PR removes `mempool_sequence` from `transactionRemovedFromMempool` and `transactionAddedToMempool`. `mempool_sequence` is not used in these methods, only in ZMQ notifications. ACKs for top commit: instagibbs: ACK bitcoin/bitcoin@55696a0 Tree-SHA512: 621e89230bcb6edfed83e2758601a2b093822fc2dc4e9bfb00487e340f2bc4c5ac3bf6df3ca00b7fe55bb3df15858820f2bf698f403d2e48b915dd9eb47b63e0
2 parents a273241 + 55696a0 commit 65ecf24

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

src/interfaces/chain.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@ class Chain
268268
{
269269
public:
270270
virtual ~Notifications() {}
271-
virtual void transactionAddedToMempool(const CTransactionRef& tx, uint64_t mempool_sequence) {}
272-
virtual void transactionRemovedFromMempool(const CTransactionRef& tx, MemPoolRemovalReason reason, uint64_t mempool_sequence) {}
271+
virtual void transactionAddedToMempool(const CTransactionRef& tx) {}
272+
virtual void transactionRemovedFromMempool(const CTransactionRef& tx, MemPoolRemovalReason reason) {}
273273
virtual void blockConnected(const BlockInfo& block) {}
274274
virtual void blockDisconnected(const BlockInfo& block) {}
275275
virtual void updatedBlockTip() {}

src/node/interfaces.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,11 @@ class NotificationsProxy : public CValidationInterface
420420
virtual ~NotificationsProxy() = default;
421421
void TransactionAddedToMempool(const CTransactionRef& tx, uint64_t mempool_sequence) override
422422
{
423-
m_notifications->transactionAddedToMempool(tx, mempool_sequence);
423+
m_notifications->transactionAddedToMempool(tx);
424424
}
425425
void TransactionRemovedFromMempool(const CTransactionRef& tx, MemPoolRemovalReason reason, uint64_t mempool_sequence) override
426426
{
427-
m_notifications->transactionRemovedFromMempool(tx, reason, mempool_sequence);
427+
m_notifications->transactionRemovedFromMempool(tx, reason);
428428
}
429429
void BlockConnected(const std::shared_ptr<const CBlock>& block, const CBlockIndex* index) override
430430
{
@@ -776,7 +776,7 @@ class ChainImpl : public Chain
776776
if (!m_node.mempool) return;
777777
LOCK2(::cs_main, m_node.mempool->cs);
778778
for (const CTxMemPoolEntry& entry : m_node.mempool->mapTx) {
779-
notifications.transactionAddedToMempool(entry.GetSharedTx(), 0 /* mempool_sequence */);
779+
notifications.transactionAddedToMempool(entry.GetSharedTx());
780780
}
781781
}
782782
bool hasAssumedValidChain() override

src/wallet/test/wallet_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ BOOST_FIXTURE_TEST_CASE(wallet_sync_tx_invalid_state_test, TestingSetup)
986986

987987
mtx.vin.clear();
988988
mtx.vin.push_back(CTxIn(tx_id_to_spend, 0));
989-
wallet.transactionAddedToMempool(MakeTransactionRef(mtx), 0);
989+
wallet.transactionAddedToMempool(MakeTransactionRef(mtx));
990990
const uint256& good_tx_id = mtx.GetHash();
991991

992992
{
@@ -1007,7 +1007,7 @@ BOOST_FIXTURE_TEST_CASE(wallet_sync_tx_invalid_state_test, TestingSetup)
10071007
static_cast<FailDatabase&>(wallet.GetDatabase()).m_pass = false;
10081008
mtx.vin.clear();
10091009
mtx.vin.push_back(CTxIn(good_tx_id, 0));
1010-
BOOST_CHECK_EXCEPTION(wallet.transactionAddedToMempool(MakeTransactionRef(mtx), 0),
1010+
BOOST_CHECK_EXCEPTION(wallet.transactionAddedToMempool(MakeTransactionRef(mtx)),
10111011
std::runtime_error,
10121012
HasReason("DB error adding transaction to wallet, write failed"));
10131013
}

src/wallet/wallet.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ void CWallet::SyncTransaction(const CTransactionRef& ptx, const SyncTxState& sta
13551355
MarkInputsDirty(ptx);
13561356
}
13571357

1358-
void CWallet::transactionAddedToMempool(const CTransactionRef& tx, uint64_t mempool_sequence) {
1358+
void CWallet::transactionAddedToMempool(const CTransactionRef& tx) {
13591359
LOCK(cs_wallet);
13601360
SyncTransaction(tx, TxStateInMempool{});
13611361

@@ -1365,7 +1365,7 @@ void CWallet::transactionAddedToMempool(const CTransactionRef& tx, uint64_t memp
13651365
}
13661366
}
13671367

1368-
void CWallet::transactionRemovedFromMempool(const CTransactionRef& tx, MemPoolRemovalReason reason, uint64_t mempool_sequence) {
1368+
void CWallet::transactionRemovedFromMempool(const CTransactionRef& tx, MemPoolRemovalReason reason) {
13691369
LOCK(cs_wallet);
13701370
auto it = mapWallet.find(tx->GetHash());
13711371
if (it != mapWallet.end()) {
@@ -1411,7 +1411,7 @@ void CWallet::blockConnected(const interfaces::BlockInfo& block)
14111411
m_last_block_processed = block.hash;
14121412
for (size_t index = 0; index < block.data->vtx.size(); index++) {
14131413
SyncTransaction(block.data->vtx[index], TxStateConfirmed{block.hash, block.height, static_cast<int>(index)});
1414-
transactionRemovedFromMempool(block.data->vtx[index], MemPoolRemovalReason::BLOCK, /*mempool_sequence=*/0);
1414+
transactionRemovedFromMempool(block.data->vtx[index], MemPoolRemovalReason::BLOCK);
14151415
}
14161416
}
14171417

src/wallet/wallet.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ class CWallet final : public WalletStorage, public interfaces::Chain::Notificati
516516
*/
517517
CWalletTx* AddToWallet(CTransactionRef tx, const TxState& state, const UpdateWalletTxFn& update_wtx=nullptr, bool fFlushOnClose=true, bool rescanning_old_block = false);
518518
bool LoadToWallet(const uint256& hash, const UpdateWalletTxFn& fill_wtx) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
519-
void transactionAddedToMempool(const CTransactionRef& tx, uint64_t mempool_sequence) override;
519+
void transactionAddedToMempool(const CTransactionRef& tx) override;
520520
void blockConnected(const interfaces::BlockInfo& block) override;
521521
void blockDisconnected(const interfaces::BlockInfo& block) override;
522522
void updatedBlockTip() override;
@@ -538,7 +538,7 @@ class CWallet final : public WalletStorage, public interfaces::Chain::Notificati
538538
uint256 last_failed_block;
539539
};
540540
ScanResult ScanForWalletTransactions(const uint256& start_block, int start_height, std::optional<int> max_height, const WalletRescanReserver& reserver, bool fUpdate, const bool save_progress);
541-
void transactionRemovedFromMempool(const CTransactionRef& tx, MemPoolRemovalReason reason, uint64_t mempool_sequence) override;
541+
void transactionRemovedFromMempool(const CTransactionRef& tx, MemPoolRemovalReason reason) override;
542542
/** Set the next time this wallet should resend transactions to 12-36 hours from now, ~1 day on average. */
543543
void SetNextResend() { m_next_resend = GetDefaultNextResend(); }
544544
/** Return true if all conditions for periodically resending transactions are met. */

0 commit comments

Comments
 (0)