Skip to content

Commit 1c95e2f

Browse files
committed
Use std::shared_ptr instead of boost::shared_ptr in ScriptForMining
1 parent 91f1e6c commit 1c95e2f

File tree

4 files changed

+8
-12
lines changed

4 files changed

+8
-12
lines changed

src/rpc/mining.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include <stdint.h>
2828

2929
#include <boost/assign/list_of.hpp>
30-
#include <boost/shared_ptr.hpp>
3130

3231
#include <univalue.h>
3332

@@ -95,7 +94,7 @@ UniValue getnetworkhashps(const JSONRPCRequest& request)
9594
return GetNetworkHashPS(request.params.size() > 0 ? request.params[0].get_int() : 120, request.params.size() > 1 ? request.params[1].get_int() : -1);
9695
}
9796

98-
UniValue generateBlocks(boost::shared_ptr<CReserveScript> coinbaseScript, int nGenerate, uint64_t nMaxTries, bool keepScript)
97+
UniValue generateBlocks(std::shared_ptr<CReserveScript> coinbaseScript, int nGenerate, uint64_t nMaxTries, bool keepScript)
9998
{
10099
static const int nInnerLoopCount = 0x10000;
101100
int nHeightStart = 0;
@@ -167,7 +166,7 @@ UniValue generate(const JSONRPCRequest& request)
167166
nMaxTries = request.params[1].get_int();
168167
}
169168

170-
boost::shared_ptr<CReserveScript> coinbaseScript;
169+
std::shared_ptr<CReserveScript> coinbaseScript;
171170
GetMainSignals().ScriptForMining(coinbaseScript);
172171

173172
// If the keypool is exhausted, no script is returned at all. Catch this.
@@ -208,7 +207,7 @@ UniValue generatetoaddress(const JSONRPCRequest& request)
208207
if (!address.IsValid())
209208
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Error: Invalid address");
210209

211-
boost::shared_ptr<CReserveScript> coinbaseScript(new CReserveScript());
210+
std::shared_ptr<CReserveScript> coinbaseScript = std::make_shared<CReserveScript>();
212211
coinbaseScript->reserveScript = GetScriptForDestination(address.Get());
213212

214213
return generateBlocks(coinbaseScript, nGenerate, nMaxTries, false);

src/validationinterface.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#define BITCOIN_VALIDATIONINTERFACE_H
88

99
#include <boost/signals2/signal.hpp>
10-
#include <boost/shared_ptr.hpp>
1110
#include <memory>
1211

1312
#include "primitives/transaction.h" // CTransaction(Ref)
@@ -42,7 +41,7 @@ class CValidationInterface {
4241
virtual void Inventory(const uint256 &hash) {}
4342
virtual void ResendWalletTransactions(int64_t nBestBlockTime, CConnman* connman) {}
4443
virtual void BlockChecked(const CBlock&, const CValidationState&) {}
45-
virtual void GetScriptForMining(boost::shared_ptr<CReserveScript>&) {};
44+
virtual void GetScriptForMining(std::shared_ptr<CReserveScript>&) {};
4645
virtual void NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_ptr<const CBlock>& block) {};
4746
friend void ::RegisterValidationInterface(CValidationInterface*);
4847
friend void ::UnregisterValidationInterface(CValidationInterface*);
@@ -77,7 +76,7 @@ struct CMainSignals {
7776
*/
7877
boost::signals2::signal<void (const CBlock&, const CValidationState&)> BlockChecked;
7978
/** Notifies listeners that a key for mining is required (coinbase) */
80-
boost::signals2::signal<void (boost::shared_ptr<CReserveScript>&)> ScriptForMining;
79+
boost::signals2::signal<void (std::shared_ptr<CReserveScript>&)> ScriptForMining;
8180
/**
8281
* Notifies listeners that a block which builds directly on our current tip
8382
* has been received and connected to the headers tree, though not validated yet */

src/wallet/wallet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3376,9 +3376,9 @@ void CWallet::UpdatedTransaction(const uint256 &hashTx)
33763376
}
33773377
}
33783378

3379-
void CWallet::GetScriptForMining(boost::shared_ptr<CReserveScript> &script)
3379+
void CWallet::GetScriptForMining(std::shared_ptr<CReserveScript> &script)
33803380
{
3381-
boost::shared_ptr<CReserveKey> rKey(new CReserveKey(this));
3381+
std::shared_ptr<CReserveKey> rKey = std::make_shared<CReserveKey>(this);
33823382
CPubKey pubkey;
33833383
if (!rKey->GetReservedKey(pubkey))
33843384
return;

src/wallet/wallet.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
#include <utility>
2929
#include <vector>
3030

31-
#include <boost/shared_ptr.hpp>
32-
3331
extern CWallet* pwalletMain;
3432

3533
/**
@@ -963,7 +961,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
963961
}
964962
}
965963

966-
void GetScriptForMining(boost::shared_ptr<CReserveScript> &script) override;
964+
void GetScriptForMining(std::shared_ptr<CReserveScript> &script) override;
967965

968966
unsigned int GetKeyPoolSize()
969967
{

0 commit comments

Comments
 (0)