Skip to content
Merged
2 changes: 1 addition & 1 deletion depends/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ HOST ?= $(BUILD)
PATCHES_PATH = $(BASEDIR)/patches
BASEDIR = $(CURDIR)
HASH_LENGTH:=11
DOWNLOAD_CONNECT_TIMEOUT:=10
DOWNLOAD_CONNECT_TIMEOUT:=30
HOST_ID_SALT ?= salt
BUILD_ID_SALT ?= salt

Expand Down
4 changes: 2 additions & 2 deletions src/httprpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static const char* WWW_AUTH_HEADER_DATA = "Basic realm=\"jsonrpc\"";
class HTTPRPCTimer : public RPCTimerBase
{
public:
HTTPRPCTimer(struct event_base* eventBase, std::function<void(void)>& func, int64_t millis) :
HTTPRPCTimer(struct event_base* eventBase, std::function<void()>& func, int64_t millis) :
ev(eventBase, false, func)
{
struct timeval tv;
Expand All @@ -52,7 +52,7 @@ class HTTPRPCTimerInterface : public RPCTimerInterface
{
return "HTTP";
}
RPCTimerBase* NewTimer(std::function<void(void)>& func, int64_t millis) override
RPCTimerBase* NewTimer(std::function<void()>& func, int64_t millis) override
{
return new HTTPRPCTimer(base, func, millis);
}
Expand Down
2 changes: 1 addition & 1 deletion src/httpserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ static void httpevent_callback_fn(evutil_socket_t, short, void* data)
delete self;
}

HTTPEvent::HTTPEvent(struct event_base* base, bool _deleteWhenTriggered, const std::function<void(void)>& _handler):
HTTPEvent::HTTPEvent(struct event_base* base, bool _deleteWhenTriggered, const std::function<void()>& _handler):
deleteWhenTriggered(_deleteWhenTriggered), handler(_handler)
{
ev = event_new(base, -1, 0, httpevent_callback_fn, this);
Expand Down
4 changes: 2 additions & 2 deletions src/httpserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class HTTPEvent
* deleteWhenTriggered deletes this event object after the event is triggered (and the handler called)
* handler is the handler to call when the event is triggered.
*/
HTTPEvent(struct event_base* base, bool deleteWhenTriggered, const std::function<void(void)>& handler);
HTTPEvent(struct event_base* base, bool deleteWhenTriggered, const std::function<void()>& handler);
~HTTPEvent();

/** Trigger the event. If tv is 0, trigger it immediately. Otherwise trigger it after
Expand All @@ -143,7 +143,7 @@ class HTTPEvent
void trigger(struct timeval* tv);

bool deleteWhenTriggered;
std::function<void(void)> handler;
std::function<void()> handler;
private:
struct event* ev;
};
Expand Down
13 changes: 10 additions & 3 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,14 @@ void SetupServerArgs()

gArgs.AddArg("-checkblockindex", strprintf("Do a full consistency check for mapBlockIndex, setBlockIndexCandidates, chainActive and mapBlocksUnlinked occasionally. (default: %u)", defaultChainParams->DefaultConsistencyChecks()), true, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-checkblocks=<n>", strprintf("How many blocks to check at startup (default: %u, 0 = all)", DEFAULT_CHECKBLOCKS), true, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-checklevel=<n>", strprintf("How thorough the block verification of -checkblocks is (0-4, default: %u)", DEFAULT_CHECKLEVEL), true, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-checklevel=<n>", strprintf("How thorough the block verification of -checkblocks is: "
"level 0 reads the blocks from disk, "
"level 1 verifies block validity, "
"level 2 verifies undo data, "
"level 3 checks disconnection of tip blocks, "
"and level 4 tries to reconnect the blocks, "
"each level includes the checks of the previous levels "
"(0-4, default: %u)", DEFAULT_CHECKLEVEL), true, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-checkmempool=<n>", strprintf("Run checks every <n> transactions (default: %u)", defaultChainParams->DefaultConsistencyChecks()), true, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-checkpoints", strprintf("Disable expensive verification for known chain history (default: %u)", DEFAULT_CHECKPOINTS_ENABLED), true, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-deprecatedrpc=<method>", "Allows deprecated RPC method(s) to be used", true, OptionsCategory::DEBUG_TEST);
Expand All @@ -642,7 +649,7 @@ void SetupServerArgs()
gArgs.AddArg("-dip3params=<activation>:<enforcement>", "Override DIP3 activation and enforcement heights", false, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-dip8params=<activation>", "Override DIP8 activation height", false, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-disablegovernance", strprintf("Disable governance validation (0-1, default: %u)", 0), false, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-help-debug", "Show all debugging options (usage: --help -help-debug)", false, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-help-debug", "Print help message with debugging options and exit", false, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-highsubsidyblocks=<n>", strprintf("The number of blocks with a higher than normal subsidy to mine at the start of a devnet (default: %u)", devnetConsensus.nHighSubsidyBlocks), false, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-highsubsidyfactor=<n>", strprintf("The factor to multiply the normal block subsidy by while in the highsubsidyblocks window of a devnet (default: %u)", devnetConsensus.nHighSubsidyFactor), false, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-llmqchainlocks=<quorum name>", strprintf("Override the default LLMQ type used for ChainLocks on a devnet. Allows using ChainLocks with smaller LLMQs. (default: %s)", devnetConsensus.llmqs.at(devnetConsensus.llmqTypeChainLocks).name), false, OptionsCategory::DEBUG_TEST);
Expand Down Expand Up @@ -987,7 +994,7 @@ void PeriodicStats()
* Ensure that Dash Core is running in a usable environment with all
* necessary library support.
*/
static bool InitSanityCheck(void)
static bool InitSanityCheck()
{
if(!ECC_InitSanityCheck()) {
InitError("Elliptic curve cryptography sanity check failure. Aborting.");
Expand Down
6 changes: 3 additions & 3 deletions src/key.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ struct CExtKey {
};

/** Initialize the elliptic curve support. May not be called twice without calling ECC_Stop first. */
void ECC_Start(void);
void ECC_Start();

/** Deinitialize the elliptic curve support. No-op if ECC_Start wasn't called first. */
void ECC_Stop(void);
void ECC_Stop();

/** Check that required EC support is available at runtime. */
bool ECC_InitSanityCheck(void);
bool ECC_InitSanityCheck();

#endif // BITCOIN_KEY_H
7 changes: 3 additions & 4 deletions src/noui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include <boost/signals2/connection.hpp>

static bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style)
bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style)
{
bool fSecure = style & CClientUIInterface::SECURE;
style &= ~CClientUIInterface::SECURE;
Expand All @@ -42,19 +42,18 @@ static bool noui_ThreadSafeMessageBox(const std::string& message, const std::str
return false;
}

static bool noui_ThreadSafeQuestion(const std::string& /* ignored interactive message */, const std::string& message, const std::string& caption, unsigned int style)
bool noui_ThreadSafeQuestion(const std::string& /* ignored interactive message */, const std::string& message, const std::string& caption, unsigned int style)
{
return noui_ThreadSafeMessageBox(message, caption, style);
}

static void noui_InitMessage(const std::string& message)
void noui_InitMessage(const std::string& message)
{
LogPrintf("init message: %s\n", message);
}
Comment thread
Munkybooty marked this conversation as resolved.
Outdated

void noui_connect()
{
// Connect dashd signal handlers
uiInterface.ThreadSafeMessageBox_connect(noui_ThreadSafeMessageBox);
uiInterface.ThreadSafeQuestion_connect(noui_ThreadSafeQuestion);
uiInterface.InitMessage_connect(noui_InitMessage);
Expand Down
12 changes: 11 additions & 1 deletion src/noui.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
#ifndef BITCOIN_NOUI_H
#define BITCOIN_NOUI_H

extern void noui_connect();
#include <string>

/** Non-GUI handler, which logs and prints messages. */
bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style);
/** Non-GUI handler, which logs and prints questions. */
bool noui_ThreadSafeQuestion(const std::string& /* ignored interactive message */, const std::string& message, const std::string& caption, unsigned int style);
/** Non-GUI handler, which only logs a message. */
void noui_InitMessage(const std::string& message);

/** Connect all bitcoind signal handlers */
void noui_connect();

#endif // BITCOIN_NOUI_H
6 changes: 5 additions & 1 deletion src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <chainparams.h>
#include <interfaces/handler.h>
#include <interfaces/node.h>
#include <noui.h>
#include <ui_interface.h>
#include <util/system.h>
#include <qt/masternodelist.h>
Expand Down Expand Up @@ -1790,8 +1791,11 @@ void BitcoinGUI::showModalOverlay()
modalOverlay->toggleVisibility();
}

static bool ThreadSafeMessageBox(BitcoinGUI *gui, const std::string& message, const std::string& caption, unsigned int style)
static bool ThreadSafeMessageBox(BitcoinGUI* gui, const std::string& message, const std::string& caption, unsigned int style)
{
// Redundantly log and print message in non-gui fashion
noui_ThreadSafeMessageBox(message, caption, style);

bool modal = (style & CClientUIInterface::MODAL);
// The SECURE flag has no effect in the Qt GUI.
// bool secure = (style & CClientUIInterface::SECURE);
Expand Down
7 changes: 4 additions & 3 deletions src/qt/dash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include <interfaces/handler.h>
#include <interfaces/node.h>
#include <noui.h>
#include <rpc/server.h>
#include <stacktraces.h>
#include <ui_interface.h>
Expand Down Expand Up @@ -70,9 +71,9 @@ Q_DECLARE_METATYPE(bool*)
Q_DECLARE_METATYPE(CAmount)
Q_DECLARE_METATYPE(uint256)

static void InitMessage(const std::string &message)
static void InitMessage(const std::string& message)
{
LogPrintf("init message: %s\n", message);
noui_InitMessage(message);
}

/** Translate string to current locale using Qt. */
Expand Down Expand Up @@ -597,7 +598,7 @@ int main(int argc, char *argv[])
// Need to pass name here as CAmount is a typedef (see http://qt-project.org/doc/qt-5/qmetatype.html#qRegisterMetaType)
// IMPORTANT if it is no longer a typedef use the normal variant above
qRegisterMetaType< CAmount >("CAmount");
qRegisterMetaType< std::function<void(void)> >("std::function<void(void)>");
qRegisterMetaType< std::function<void()> >("std::function<void()>");
#ifdef ENABLE_WALLET
qRegisterMetaType<WalletModel*>("WalletModel*");
#endif
Expand Down
31 changes: 7 additions & 24 deletions src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
#include <shlwapi.h>
#endif

#include <boost/scoped_array.hpp>

#include <QAbstractButton>
#include <QAbstractItemView>
#include <QApplication>
Expand Down Expand Up @@ -793,52 +791,37 @@ bool SetStartOnSystemStartup(bool fAutoStart)
CoInitialize(nullptr);

// Get a pointer to the IShellLink interface.
IShellLink* psl = nullptr;
IShellLinkW* psl = nullptr;
Comment thread
Munkybooty marked this conversation as resolved.
Outdated
HRESULT hres = CoCreateInstance(CLSID_ShellLink, nullptr,
CLSCTX_INPROC_SERVER, IID_IShellLink,
CLSCTX_INPROC_SERVER, IID_IShellLinkW,
reinterpret_cast<void**>(&psl));

if (SUCCEEDED(hres))
{
// Get the current executable path
TCHAR pszExePath[MAX_PATH];
GetModuleFileName(nullptr, pszExePath, sizeof(pszExePath));
WCHAR pszExePath[MAX_PATH];
GetModuleFileNameW(nullptr, pszExePath, ARRAYSIZE(pszExePath));

// Start client minimized
QString strArgs = "-min";
// Set -testnet /-regtest options
strArgs += QString::fromStdString(strprintf(" -testnet=%d -regtest=%d", gArgs.GetBoolArg("-testnet", false), gArgs.GetBoolArg("-regtest", false)));

#ifdef UNICODE
boost::scoped_array<TCHAR> args(new TCHAR[strArgs.length() + 1]);
// Convert the QString to TCHAR*
strArgs.toWCharArray(args.get());
// Add missing '\0'-termination to string
args[strArgs.length()] = '\0';
#endif

// Set the path to the shortcut target
psl->SetPath(pszExePath);
PathRemoveFileSpec(pszExePath);
PathRemoveFileSpecW(pszExePath);
psl->SetWorkingDirectory(pszExePath);
psl->SetShowCmd(SW_SHOWMINNOACTIVE);
#ifndef UNICODE
psl->SetArguments(strArgs.toStdString().c_str());
#else
psl->SetArguments(args.get());
#endif
psl->SetArguments(strArgs.toStdWString().c_str());

// Query IShellLink for the IPersistFile interface for
// saving the shortcut in persistent storage.
IPersistFile* ppf = nullptr;
hres = psl->QueryInterface(IID_IPersistFile, reinterpret_cast<void**>(&ppf));
if (SUCCEEDED(hres))
{
WCHAR pwsz[MAX_PATH];
// Ensure that the string is ANSI.
MultiByteToWideChar(CP_ACP, 0, StartupShortcutPath().string().c_str(), -1, pwsz, MAX_PATH);
// Save the link by calling IPersistFile::Save.
hres = ppf->Save(pwsz, TRUE);
hres = ppf->Save(StartupShortcutPath().wstring().c_str(), TRUE);
ppf->Release();
psl->Release();
CoUninitialize();
Expand Down
2 changes: 1 addition & 1 deletion src/qt/macnotificationhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class MacNotificationHandler : public QObject
void showNotification(const QString &title, const QString &text);

/** check if OS can handle UserNotifications */
bool hasUserNotificationCenterSupport(void);
bool hasUserNotificationCenterSupport();
static MacNotificationHandler *instance();
};

Expand Down
1 change: 0 additions & 1 deletion src/qt/paymentrequestplus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ bool PaymentRequestPlus::getMerchant(X509_STORE* certStore, QString& merchant) c
if (result != 1) {
int error = X509_STORE_CTX_get_error(store_ctx);
// For testing payment requests, we allow self signed root certs!
// This option is just shown in the UI options, if -help-debug is enabled.
if (!(error == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT && gArgs.GetBoolArg("-allowselfsignedrootcertificates", DEFAULT_SELFSIGNED_ROOTCERTS))) {
throw SSLVerifyError(X509_verify_cert_error_string(error));
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class QtRPCTimerBase: public QObject, public RPCTimerBase
{
Q_OBJECT
public:
QtRPCTimerBase(std::function<void(void)>& _func, int64_t millis):
QtRPCTimerBase(std::function<void()>& _func, int64_t millis):
func(_func)
{
timer.setSingleShot(true);
Expand All @@ -116,15 +116,15 @@ private Q_SLOTS:
void timeout() { func(); }
private:
QTimer timer;
std::function<void(void)> func;
std::function<void()> func;
};

class QtRPCTimerInterface: public RPCTimerInterface
{
public:
~QtRPCTimerInterface() {}
const char *Name() override { return "Qt"; }
RPCTimerBase* NewTimer(std::function<void(void)>& func, int64_t millis) override
RPCTimerBase* NewTimer(std::function<void()>& func, int64_t millis) override
{
return new QtRPCTimerBase(func, millis);
}
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ void RPCUnsetTimerInterface(RPCTimerInterface *iface)
timerInterface = nullptr;
}

void RPCRunLater(const std::string& name, std::function<void(void)> func, int64_t nSeconds)
void RPCRunLater(const std::string& name, std::function<void()> func, int64_t nSeconds)
{
if (!timerInterface)
throw JSONRPCError(RPC_INTERNAL_ERROR, "No timer handler registered for RPC");
Expand Down
4 changes: 2 additions & 2 deletions src/rpc/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class RPCTimerInterface
* This is needed to cope with the case in which there is no HTTP server, but
* only GUI RPC console, and to break the dependency of pcserver on httprpc.
*/
virtual RPCTimerBase* NewTimer(std::function<void(void)>& func, int64_t millis) = 0;
virtual RPCTimerBase* NewTimer(std::function<void()>& func, int64_t millis) = 0;
};

/** Set the factory function for timers */
Expand All @@ -122,7 +122,7 @@ void RPCUnsetTimerInterface(RPCTimerInterface *iface);
* Run func nSeconds from now.
* Overrides previous timer <name> (if any).
*/
void RPCRunLater(const std::string& name, std::function<void(void)> func, int64_t nSeconds);
void RPCRunLater(const std::string& name, std::function<void()> func, int64_t nSeconds);

typedef UniValue(*rpcfn_type)(const JSONRPCRequest& jsonRequest);

Expand Down
4 changes: 2 additions & 2 deletions src/scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void SingleThreadedSchedulerClient::MaybeScheduleProcessQueue() {
}

void SingleThreadedSchedulerClient::ProcessQueue() {
std::function<void (void)> callback;
std::function<void ()> callback;
{
LOCK(m_cs_callbacks_pending);
if (m_are_callbacks_running) return;
Expand Down Expand Up @@ -187,7 +187,7 @@ void SingleThreadedSchedulerClient::ProcessQueue() {
callback();
}

void SingleThreadedSchedulerClient::AddToProcessQueue(std::function<void (void)> func) {
void SingleThreadedSchedulerClient::AddToProcessQueue(std::function<void ()> func) {
assert(m_pscheduler);

{
Expand Down
6 changes: 3 additions & 3 deletions src/scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CScheduler
CScheduler();
~CScheduler();

typedef std::function<void(void)> Function;
typedef std::function<void()> Function;

// Call func at/after time t
void schedule(Function f, boost::chrono::system_clock::time_point t=boost::chrono::system_clock::now());
Expand Down Expand Up @@ -99,7 +99,7 @@ class SingleThreadedSchedulerClient {
CScheduler *m_pscheduler;

CCriticalSection m_cs_callbacks_pending;
std::list<std::function<void (void)>> m_callbacks_pending GUARDED_BY(m_cs_callbacks_pending);
std::list<std::function<void ()>> m_callbacks_pending GUARDED_BY(m_cs_callbacks_pending);
bool m_are_callbacks_running GUARDED_BY(m_cs_callbacks_pending) = false;

void MaybeScheduleProcessQueue();
Expand All @@ -114,7 +114,7 @@ class SingleThreadedSchedulerClient {
* Practially, this means that callbacks can behave as if they are executed
* in order by a single thread.
*/
void AddToProcessQueue(std::function<void (void)> func);
void AddToProcessQueue(std::function<void ()> func);

// Processes all remaining queue members on the calling thread, blocking until queue is empty
// Must be called after the CScheduler has no remaining processing threads!
Expand Down
2 changes: 1 addition & 1 deletion src/test/crypto_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ static void TestPoly1305(const std::string &hexmessage, const std::string &hexke
BOOST_CHECK(tag == tagres);
}

static std::string LongTestString(void) {
static std::string LongTestString() {
std::string ret;
for (int i=0; i<200000; i++) {
ret += (unsigned char)(i);
Expand Down
Loading