Skip to content

Commit

Permalink
Merge pull request dogecoin#3301 from patricklodder/1.14.7-remove-boo…
Browse files Browse the repository at this point in the history
…st-sharedptr

replace boost::shared_ptr with std::shared_ptr
  • Loading branch information
chromatic authored Aug 30, 2023
2 parents 0014ad2 + 0d39941 commit 836753e
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 16 deletions.
4 changes: 1 addition & 3 deletions src/primitives/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#include "serialize.h"
#include "uint256.h"

#include <boost/shared_ptr.hpp>

/** Nodes collect new transactions into a block, hash them into a hash tree,
* and scan through nonce values to make the block's hash satisfy proof-of-work
* requirements. When they solve the proof-of-work, they broadcast the block
Expand All @@ -25,7 +23,7 @@ class CBlockHeader : public CPureBlockHeader
{
public:
// auxpow (if this is a merge-minded block)
boost::shared_ptr<CAuxPow> auxpow;
std::shared_ptr<CAuxPow> auxpow;

CBlockHeader()
{
Expand Down
9 changes: 4 additions & 5 deletions src/rpc/mining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <stdint.h>

#include <boost/assign/list_of.hpp>
#include <boost/shared_ptr.hpp>

#include <univalue.h>

Expand Down Expand Up @@ -97,7 +96,7 @@ UniValue getnetworkhashps(const JSONRPCRequest& request)
return GetNetworkHashPS(request.params.size() > 0 ? request.params[0].get_int() : 120, request.params.size() > 1 ? request.params[1].get_int() : -1);
}

UniValue generateBlocks(boost::shared_ptr<CReserveScript> coinbaseScript, int nGenerate, uint64_t nMaxTries, bool keepScript, int nMineAuxPow)
UniValue generateBlocks(std::shared_ptr<CReserveScript> coinbaseScript, int nGenerate, uint64_t nMaxTries, bool keepScript, int nMineAuxPow)
{
// Dogecoin: Never mine witness tx
const bool fMineWitnessTx = false;
Expand Down Expand Up @@ -198,7 +197,7 @@ UniValue generate(const JSONRPCRequest& request)
nMineAuxPow = request.params[2].get_int();
}

boost::shared_ptr<CReserveScript> coinbaseScript;
std::shared_ptr<CReserveScript> coinbaseScript;
GetMainSignals().ScriptForMining(coinbaseScript);

// If the keypool is exhausted, no script is returned at all. Catch this.
Expand Down Expand Up @@ -245,7 +244,7 @@ UniValue generatetoaddress(const JSONRPCRequest& request)
if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Error: Invalid address");

boost::shared_ptr<CReserveScript> coinbaseScript(new CReserveScript());
std::shared_ptr<CReserveScript> coinbaseScript(new CReserveScript());
coinbaseScript->reserveScript = GetScriptForDestination(address.Get());

return generateBlocks(coinbaseScript, nGenerate, nMaxTries, false, nMineAuxPow);
Expand Down Expand Up @@ -1164,7 +1163,7 @@ UniValue getauxblockbip22(const JSONRPCRequest& request)
+ HelpExampleRpc("getauxblock", "")
);

boost::shared_ptr<CReserveScript> coinbaseScript;
std::shared_ptr<CReserveScript> coinbaseScript;
GetMainSignals().ScriptForMining(coinbaseScript);

// If the keypool is exhausted, no script is returned at all. Catch this.
Expand Down
1 change: 0 additions & 1 deletion src/rpc/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <boost/bind/bind.hpp>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/signals2/signal.hpp>
#include <boost/thread.hpp>
#include <boost/algorithm/string/case_conv.hpp> // for to_upper()
Expand Down
5 changes: 2 additions & 3 deletions src/validationinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#define BITCOIN_VALIDATIONINTERFACE_H

#include <boost/signals2/signal.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>

class CBlock;
Expand Down Expand Up @@ -39,7 +38,7 @@ class CValidationInterface {
virtual void UpdatedTransaction(const uint256 &hash) {}
virtual void ResendWalletTransactions(int64_t nBestBlockTime, CConnman* connman) {}
virtual void BlockChecked(const CBlock&, const CValidationState&) {}
virtual void GetScriptForMining(boost::shared_ptr<CReserveScript>&) {};
virtual void GetScriptForMining(std::shared_ptr<CReserveScript>&) {};
virtual void ResetRequestCount(const uint256 &hash) {};
virtual void NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_ptr<const CBlock>& block) {};
friend void ::RegisterValidationInterface(CValidationInterface*);
Expand Down Expand Up @@ -70,7 +69,7 @@ struct CMainSignals {
/** Notifies listeners of a block validation result */
boost::signals2::signal<void (const CBlock&, const CValidationState&)> BlockChecked;
/** Notifies listeners that a key for mining is required (coinbase) */
boost::signals2::signal<void (boost::shared_ptr<CReserveScript>&)> ScriptForMining;
boost::signals2::signal<void (std::shared_ptr<CReserveScript>&)> ScriptForMining;
/** Notifies listeners that a block has been successfully mined */
boost::signals2::signal<void (const uint256 &)> BlockFound;
/**
Expand Down
4 changes: 2 additions & 2 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3458,9 +3458,9 @@ void CWallet::UpdatedTransaction(const uint256 &hashTx)
}
}

void CWallet::GetScriptForMining(boost::shared_ptr<CReserveScript> &script)
void CWallet::GetScriptForMining(std::shared_ptr<CReserveScript> &script)
{
boost::shared_ptr<CReserveKey> rKey(new CReserveKey(this));
std::shared_ptr<CReserveKey> rKey(new CReserveKey(this));
CPubKey pubkey;
if (!rKey->GetReservedKey(pubkey))
return;
Expand Down
3 changes: 1 addition & 2 deletions src/wallet/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include <utility>
#include <vector>

#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>

extern CWallet* pwalletMain;
Expand Down Expand Up @@ -878,7 +877,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface

void UpdatedTransaction(const uint256 &hashTx) override;

void GetScriptForMining(boost::shared_ptr<CReserveScript> &script) override;
void GetScriptForMining(std::shared_ptr<CReserveScript> &script) override;

unsigned int GetKeyPoolSize()
{
Expand Down

0 comments on commit 836753e

Please sign in to comment.