aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac14
-rw-r--r--src/test/fuzz/fuzz.cpp9
-rw-r--r--src/wallet/rpcwallet.cpp2
-rwxr-xr-xtest/functional/wallet_multiwallet.py4
4 files changed, 17 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac
index fbf56443f1..674ed1ee73 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1165,6 +1165,20 @@ if test "x$enable_fuzz" = "xyes"; then
use_bench=no
use_upnp=no
use_zmq=no
+
+ AC_MSG_CHECKING([whether main function is needed])
+ AX_CHECK_LINK_FLAG(
+ [[-fsanitize=$use_sanitizers]],
+ [AC_MSG_RESULT([no])],
+ [AC_MSG_RESULT([yes])
+ CPPFLAGS="$CPPFLAGS -DPROVIDE_MAIN_FUNCTION"],
+ [],
+ [AC_LANG_PROGRAM([[
+ #include <cstdint>
+ #include <cstddef>
+ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { return 0; }
+ /* unterminated comment to remove the main function ...
+ ]],[[]])])
else
BITCOIN_QT_INIT
diff --git a/src/test/fuzz/fuzz.cpp b/src/test/fuzz/fuzz.cpp
index 1e1807d734..753cfffdcb 100644
--- a/src/test/fuzz/fuzz.cpp
+++ b/src/test/fuzz/fuzz.cpp
@@ -12,15 +12,6 @@
const std::function<void(const std::string&)> G_TEST_LOG_FUN{};
-// Decide if main(...) should be provided:
-// * AFL needs main(...) regardless of platform.
-// * macOS handles __attribute__((weak)) main(...) poorly when linking
-// against libFuzzer. See https://github.com/bitcoin/bitcoin/pull/18008
-// for details.
-#if defined(__AFL_COMPILER) || !defined(MAC_OSX)
-#define PROVIDE_MAIN_FUNCTION
-#endif
-
#if defined(PROVIDE_MAIN_FUNCTION)
static bool read_stdin(std::vector<uint8_t>& data)
{
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index 4a11eb1669..23291e3a48 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -112,7 +112,7 @@ std::shared_ptr<CWallet> GetWalletForJSONRPCRequest(const JSONRPCRequest& reques
if (wallets.empty()) {
throw JSONRPCError(
- RPC_METHOD_NOT_FOUND, "Method not found (wallet method is disabled because no wallet is loaded)");
+ RPC_WALLET_NOT_FOUND, "No wallet is loaded. Load a wallet using loadwallet or create a new one with createwallet. (Note: A default wallet is no longer automatically created)");
}
throw JSONRPCError(RPC_WALLET_NOT_SPECIFIED,
"Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path).");
diff --git a/test/functional/wallet_multiwallet.py b/test/functional/wallet_multiwallet.py
index 155a3be7e2..a0787dd289 100755
--- a/test/functional/wallet_multiwallet.py
+++ b/test/functional/wallet_multiwallet.py
@@ -204,7 +204,7 @@ class MultiWalletTest(BitcoinTestFramework):
self.restart_node(0, ['-nowallet'])
assert_equal(node.listwallets(), [])
- assert_raises_rpc_error(-32601, "Method not found", node.getwalletinfo)
+ assert_raises_rpc_error(-18, "No wallet is loaded. Load a wallet using loadwallet or create a new one with createwallet. (Note: A default wallet is no longer automatically created)", node.getwalletinfo)
self.log.info("Load first wallet")
loadwallet_name = node.loadwallet(wallet_names[0])
@@ -316,7 +316,7 @@ class MultiWalletTest(BitcoinTestFramework):
for wallet_name in self.nodes[0].listwallets():
self.nodes[0].unloadwallet(wallet_name)
assert_equal(self.nodes[0].listwallets(), [])
- assert_raises_rpc_error(-32601, "Method not found (wallet method is disabled because no wallet is loaded)", self.nodes[0].getwalletinfo)
+ assert_raises_rpc_error(-18, "No wallet is loaded. Load a wallet using loadwallet or create a new one with createwallet. (Note: A default wallet is no longer automatically created)", self.nodes[0].getwalletinfo)
# Successfully load a previously unloaded wallet
self.nodes[0].loadwallet('w1')