mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-13 22:24:05 +01:00
scripted-diff: remove Optional & nullopt
-BEGIN VERIFY SCRIPT-
git rm src/optional.h
sed -i -e 's/Optional</std::optional</g' $(git grep -l 'Optional<' src)
sed -i -e 's/{nullopt}/{std::nullopt}/g' $(git grep -l 'nullopt' src)
sed -i -e 's/ nullopt;/ std::nullopt;/g' $(git grep -l 'nullopt' src)
sed -i -e 's/ nullopt)/ std::nullopt)/g' $(git grep -l 'nullopt' src)
sed -i -e 's/(nullopt)/(std::nullopt)/g' $(git grep -l 'nullopt' src)
sed -i -e 's/ nullopt,/ std::nullopt,/g' $(git grep -l 'nullopt' src)
sed -i -e 's/? nullopt :/? std::nullopt :/g' $(git grep -l 'nullopt' src)
sed -i -e 's/: nullopt}/: std::nullopt}/g' $(git grep -l 'nullopt' src)
sed -i -e '/optional.h \\/d' src/Makefile.am
sed -i -e '/#include <optional.h>/d' src/test/fuzz/autofile.cpp src/test/fuzz/buffered_file.cpp src/test/fuzz/node_eviction.cpp
sed -i -e 's/#include <optional.h>/#include <optional>/g' $(git grep -l '#include <optional.h>' src)
-END VERIFY SCRIPT-
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <chainparamsbase.h>
|
||||
#include <clientversion.h>
|
||||
#include <optional.h>
|
||||
#include <optional>
|
||||
#include <rpc/client.h>
|
||||
#include <rpc/mining.h>
|
||||
#include <rpc/protocol.h>
|
||||
@@ -611,7 +611,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
static UniValue CallRPC(BaseRequestHandler* rh, const std::string& strMethod, const std::vector<std::string>& args, const Optional<std::string>& rpcwallet = {})
|
||||
static UniValue CallRPC(BaseRequestHandler* rh, const std::string& strMethod, const std::vector<std::string>& args, const std::optional<std::string>& rpcwallet = {})
|
||||
{
|
||||
std::string host;
|
||||
// In preference order, we choose the following for the port:
|
||||
@@ -733,7 +733,7 @@ static UniValue CallRPC(BaseRequestHandler* rh, const std::string& strMethod, co
|
||||
* @returns the RPC response as a UniValue object.
|
||||
* @throws a CConnectionFailed std::runtime_error if connection failed or RPC server still in warmup.
|
||||
*/
|
||||
static UniValue ConnectAndCallRPC(BaseRequestHandler* rh, const std::string& strMethod, const std::vector<std::string>& args, const Optional<std::string>& rpcwallet = {})
|
||||
static UniValue ConnectAndCallRPC(BaseRequestHandler* rh, const std::string& strMethod, const std::vector<std::string>& args, const std::optional<std::string>& rpcwallet = {})
|
||||
{
|
||||
UniValue response(UniValue::VOBJ);
|
||||
// Execute and handle connection failures with -rpcwait.
|
||||
@@ -817,7 +817,7 @@ static void GetWalletBalances(UniValue& result)
|
||||
*/
|
||||
static UniValue GetNewAddress()
|
||||
{
|
||||
Optional<std::string> wallet_name{};
|
||||
std::optional<std::string> wallet_name{};
|
||||
if (gArgs.IsArgSet("-rpcwallet")) wallet_name = gArgs.GetArg("-rpcwallet", "");
|
||||
DefaultRequestHandler rh;
|
||||
return ConnectAndCallRPC(&rh, "getnewaddress", /* args=*/{}, wallet_name);
|
||||
@@ -922,7 +922,7 @@ static int CommandLineRPC(int argc, char *argv[])
|
||||
}
|
||||
if (nRet == 0) {
|
||||
// Perform RPC call
|
||||
Optional<std::string> wallet_name{};
|
||||
std::optional<std::string> wallet_name{};
|
||||
if (gArgs.IsArgSet("-rpcwallet")) wallet_name = gArgs.GetArg("-rpcwallet", "");
|
||||
const UniValue reply = ConnectAndCallRPC(rh.get(), method, args, wallet_name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user