refactor: Add handleNotifications method to wallet

Further stylistic cleanups in touched files:

* Sort the includes
* Wrap long single-line constructors into multiple lines
This commit is contained in:
MarcoFalke
2019-04-17 13:27:02 -04:00
parent fa46ac3127
commit fad7c33342
4 changed files with 27 additions and 32 deletions

View File

@@ -5,9 +5,8 @@
#include <wallet/wallet.h>
#include <checkpoints.h>
#include <chain.h>
#include <wallet/coincontrol.h>
#include <checkpoints.h>
#include <consensus/consensus.h>
#include <consensus/validation.h>
#include <fs.h>
@@ -16,7 +15,6 @@
#include <key.h>
#include <key_io.h>
#include <keystore.h>
#include <validation.h>
#include <net.h>
#include <policy/fees.h>
#include <policy/policy.h>
@@ -34,6 +32,8 @@
#include <util/moneystr.h>
#include <util/rbf.h>
#include <util/validation.h>
#include <validation.h>
#include <wallet/coincontrol.h>
#include <wallet/fees.h>
#include <algorithm>
@@ -4303,7 +4303,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
chain.loadWallet(interfaces::MakeWallet(walletInstance));
// Register with the validation interface. It's ok to do this after rescan since we're still holding locked_chain.
walletInstance->m_chain_notifications_handler = chain.handleNotifications(*walletInstance);
walletInstance->handleNotifications();
walletInstance->SetBroadcastTransactions(gArgs.GetBoolArg("-walletbroadcast", DEFAULT_WALLETBROADCAST));
@@ -4316,6 +4316,11 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
return walletInstance;
}
void CWallet::handleNotifications()
{
m_chain_notifications_handler = m_chain->handleNotifications(*this);
}
void CWallet::postInitProcess()
{
auto locked_chain = chain().lock();