Skip to content

Commit 6ceb219

Browse files
committed
refactor: Rename Chain::Notifications methods to be consistent with other interfaces methods
This also simplifies #10102 removing overrides needed to deal with inconsistent case convention
1 parent 1c2ab1a commit 6ceb219

File tree

4 files changed

+29
-29
lines changed

4 files changed

+29
-29
lines changed

src/interfaces/chain.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,25 +166,25 @@ class NotificationsHandlerImpl : public Handler, CValidationInterface
166166
}
167167
void TransactionAddedToMempool(const CTransactionRef& tx) override
168168
{
169-
m_notifications->TransactionAddedToMempool(tx);
169+
m_notifications->transactionAddedToMempool(tx);
170170
}
171171
void TransactionRemovedFromMempool(const CTransactionRef& tx) override
172172
{
173-
m_notifications->TransactionRemovedFromMempool(tx);
173+
m_notifications->transactionRemovedFromMempool(tx);
174174
}
175175
void BlockConnected(const std::shared_ptr<const CBlock>& block, const CBlockIndex* index) override
176176
{
177-
m_notifications->BlockConnected(*block, index->nHeight);
177+
m_notifications->blockConnected(*block, index->nHeight);
178178
}
179179
void BlockDisconnected(const std::shared_ptr<const CBlock>& block, const CBlockIndex* index) override
180180
{
181-
m_notifications->BlockDisconnected(*block, index->nHeight);
181+
m_notifications->blockDisconnected(*block, index->nHeight);
182182
}
183183
void UpdatedBlockTip(const CBlockIndex* index, const CBlockIndex* fork_index, bool is_ibd) override
184184
{
185-
m_notifications->UpdatedBlockTip();
185+
m_notifications->updatedBlockTip();
186186
}
187-
void ChainStateFlushed(const CBlockLocator& locator) override { m_notifications->ChainStateFlushed(locator); }
187+
void ChainStateFlushed(const CBlockLocator& locator) override { m_notifications->chainStateFlushed(locator); }
188188
Chain& m_chain;
189189
Chain::Notifications* m_notifications;
190190
};
@@ -366,7 +366,7 @@ class ChainImpl : public Chain
366366
{
367367
LOCK2(::cs_main, ::mempool.cs);
368368
for (const CTxMemPoolEntry& entry : ::mempool.mapTx) {
369-
notifications.TransactionAddedToMempool(entry.GetSharedTx());
369+
notifications.transactionAddedToMempool(entry.GetSharedTx());
370370
}
371371
}
372372
NodeContext& m_node;

src/interfaces/chain.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,12 @@ class Chain
217217
{
218218
public:
219219
virtual ~Notifications() {}
220-
virtual void TransactionAddedToMempool(const CTransactionRef& tx) {}
221-
virtual void TransactionRemovedFromMempool(const CTransactionRef& ptx) {}
222-
virtual void BlockConnected(const CBlock& block, int height) {}
223-
virtual void BlockDisconnected(const CBlock& block, int height) {}
224-
virtual void UpdatedBlockTip() {}
225-
virtual void ChainStateFlushed(const CBlockLocator& locator) {}
220+
virtual void transactionAddedToMempool(const CTransactionRef& tx) {}
221+
virtual void transactionRemovedFromMempool(const CTransactionRef& ptx) {}
222+
virtual void blockConnected(const CBlock& block, int height) {}
223+
virtual void blockDisconnected(const CBlock& block, int height) {}
224+
virtual void updatedBlockTip() {}
225+
virtual void chainStateFlushed(const CBlockLocator& locator) {}
226226
};
227227

228228
//! Register handler for notifications.
@@ -245,7 +245,7 @@ class Chain
245245
//! Current RPC serialization flags.
246246
virtual int rpcSerializationFlags() = 0;
247247

248-
//! Synchronously send TransactionAddedToMempool notifications about all
248+
//! Synchronously send transactionAddedToMempool notifications about all
249249
//! current mempool transactions to the specified handler and return after
250250
//! the last one is sent. These notifications aren't coordinated with async
251251
//! notifications sent by handleNotifications, so out of date async

src/wallet/wallet.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ bool CWallet::ChangeWalletPassphrase(const SecureString& strOldWalletPassphrase,
344344
return false;
345345
}
346346

347-
void CWallet::ChainStateFlushed(const CBlockLocator& loc)
347+
void CWallet::chainStateFlushed(const CBlockLocator& loc)
348348
{
349349
WalletBatch batch(*database);
350350
batch.WriteBestBlock(loc);
@@ -1089,7 +1089,7 @@ void CWallet::SyncTransaction(const CTransactionRef& ptx, CWalletTx::Confirmatio
10891089
MarkInputsDirty(ptx);
10901090
}
10911091

1092-
void CWallet::TransactionAddedToMempool(const CTransactionRef& ptx) {
1092+
void CWallet::transactionAddedToMempool(const CTransactionRef& ptx) {
10931093
auto locked_chain = chain().lock();
10941094
LOCK(cs_wallet);
10951095
CWalletTx::Confirmation confirm(CWalletTx::Status::UNCONFIRMED, /* block_height */ 0, {}, /* nIndex */ 0);
@@ -1101,15 +1101,15 @@ void CWallet::TransactionAddedToMempool(const CTransactionRef& ptx) {
11011101
}
11021102
}
11031103

1104-
void CWallet::TransactionRemovedFromMempool(const CTransactionRef &ptx) {
1104+
void CWallet::transactionRemovedFromMempool(const CTransactionRef &ptx) {
11051105
LOCK(cs_wallet);
11061106
auto it = mapWallet.find(ptx->GetHash());
11071107
if (it != mapWallet.end()) {
11081108
it->second.fInMempool = false;
11091109
}
11101110
}
11111111

1112-
void CWallet::BlockConnected(const CBlock& block, int height)
1112+
void CWallet::blockConnected(const CBlock& block, int height)
11131113
{
11141114
const uint256& block_hash = block.GetHash();
11151115
auto locked_chain = chain().lock();
@@ -1120,11 +1120,11 @@ void CWallet::BlockConnected(const CBlock& block, int height)
11201120
for (size_t index = 0; index < block.vtx.size(); index++) {
11211121
CWalletTx::Confirmation confirm(CWalletTx::Status::CONFIRMED, height, block_hash, index);
11221122
SyncTransaction(block.vtx[index], confirm);
1123-
TransactionRemovedFromMempool(block.vtx[index]);
1123+
transactionRemovedFromMempool(block.vtx[index]);
11241124
}
11251125
}
11261126

1127-
void CWallet::BlockDisconnected(const CBlock& block, int height)
1127+
void CWallet::blockDisconnected(const CBlock& block, int height)
11281128
{
11291129
auto locked_chain = chain().lock();
11301130
LOCK(cs_wallet);
@@ -1141,7 +1141,7 @@ void CWallet::BlockDisconnected(const CBlock& block, int height)
11411141
}
11421142
}
11431143

1144-
void CWallet::UpdatedBlockTip()
1144+
void CWallet::updatedBlockTip()
11451145
{
11461146
m_best_block_time = GetTime();
11471147
}
@@ -3875,7 +3875,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
38753875
}
38763876

38773877
auto locked_chain = chain.lock();
3878-
walletInstance->ChainStateFlushed(locked_chain->getTipLocator());
3878+
walletInstance->chainStateFlushed(locked_chain->getTipLocator());
38793879
} else if (wallet_creation_flags & WALLET_FLAG_DISABLE_PRIVATE_KEYS) {
38803880
// Make it impossible to disable private keys after creation
38813881
error = strprintf(_("Error loading %s: Private keys can only be disabled during creation").translated, walletFile);
@@ -4056,7 +4056,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
40564056
return nullptr;
40574057
}
40584058
}
4059-
walletInstance->ChainStateFlushed(locked_chain->getTipLocator());
4059+
walletInstance->chainStateFlushed(locked_chain->getTipLocator());
40604060
walletInstance->database->IncrementUpdateCounter();
40614061

40624062
// Restore wallet transaction metadata after -zapwallettxes=1

src/wallet/wallet.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -875,10 +875,10 @@ class CWallet final : public WalletStorage, private interfaces::Chain::Notificat
875875
void MarkDirty();
876876
bool AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose=true);
877877
void LoadToWallet(CWalletTx& wtxIn) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
878-
void TransactionAddedToMempool(const CTransactionRef& tx) override;
879-
void BlockConnected(const CBlock& block, int height) override;
880-
void BlockDisconnected(const CBlock& block, int height) override;
881-
void UpdatedBlockTip() override;
878+
void transactionAddedToMempool(const CTransactionRef& tx) override;
879+
void blockConnected(const CBlock& block, int height) override;
880+
void blockDisconnected(const CBlock& block, int height) override;
881+
void updatedBlockTip() override;
882882
int64_t RescanFromTime(int64_t startTime, const WalletRescanReserver& reserver, bool update);
883883

884884
struct ScanResult {
@@ -897,7 +897,7 @@ class CWallet final : public WalletStorage, private interfaces::Chain::Notificat
897897
uint256 last_failed_block;
898898
};
899899
ScanResult ScanForWalletTransactions(const uint256& first_block, const uint256& last_block, const WalletRescanReserver& reserver, bool fUpdate);
900-
void TransactionRemovedFromMempool(const CTransactionRef &ptx) override;
900+
void transactionRemovedFromMempool(const CTransactionRef &ptx) override;
901901
void ReacceptWalletTransactions() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
902902
void ResendWalletTransactions();
903903
struct Balance {
@@ -1033,7 +1033,7 @@ class CWallet final : public WalletStorage, private interfaces::Chain::Notificat
10331033
bool IsAllFromMe(const CTransaction& tx, const isminefilter& filter) const;
10341034
CAmount GetCredit(const CTransaction& tx, const isminefilter& filter) const;
10351035
CAmount GetChange(const CTransaction& tx) const;
1036-
void ChainStateFlushed(const CBlockLocator& loc) override;
1036+
void chainStateFlushed(const CBlockLocator& loc) override;
10371037

10381038
DBErrors LoadWallet(bool& fFirstRunRet);
10391039
DBErrors ZapWalletTx(std::vector<CWalletTx>& vWtx);

0 commit comments

Comments
 (0)